Talk on Introducing Metaclasses at PyDelhi Meetup 🎙️
Core Python · PyDelhiHey! I gave a talk on Python Metaclasses yesterday at PyDelhi Meetup at Lyxel labs, Gurgaon .
Interested in learning Metaclasses? Come to #PyDelhi meetup tomorrow to watch @iaktech introducing metaclasses at #LyxelLabs, Gurgaon.
— PyDelhi (@PyDelhi) May 27, 2016
In order to develop an intuition to understand metaclasses in python, Let’s see it in this way: “Everything is an object in Python”, So is a class! and every object is created by a class, of course:
>>> class Foo(): pass
>>> foo_object = Foo()
The class which creates the foo_object
is:
>>> type(foo)
__main__.Foo
That’s what we expected, Foo
!
Now, as I said earlier, every class is also an object, So is Foo
, now lets see which class creates the class Foo
itself:
>>> type(Foo)
type
The type
! Yes, the type
class creates the Foo
class and that’s what called as a Metaclass. Metaclasses are the secret sauce which creates classes! type
is the default metaclass in Python. To dive more into Metaclasses, have a look at the presentation slides of
my talk.
Tip : Interested in tasting bit more of Python? Come to PyDelhi Meetups! or if you would like to taste lot of python, then you should come to PyCon India 2016, its a premier conference in India on using and developing the Python programming language & is conducted annually by the Python developer community. It attracts the best Python programmers from across the country and abroad.
If you missed my talk or attended and liked it, then you should definitely have a look at my proposal for this talk at PyCon India 2016 or you can submit your own proposal here, the call for proposals is open ;)
Here is a picture of an another talk by Peeyush Aggarwal (@dhuadaar) on NLP.
See you in the next meetup :)