Understanding Python: Metaclasses

preview_player
Показать описание
In this video, I go over how to create and use metaclasses.
Included in the lesson are a dive into how classes are constructed, a demonstration of four metaclass magic methods, and the creation of two custom metaclasses.
As always, if you have any questions or suggestions for future videos, please leave a comment down below.

Timelapse music: 失望した by Eva
Outro music: Elix by Synthness
Рекомендации по теме
Комментарии
Автор

You're literally the Bob Ross of programming. Amazing.

dragonkat
Автор

this video doesn't deserve this amount of views, why are there so few of them??? thank you for making it clean for me!

armii
Автор

During example3 you created an instance using Example instead of Example3. Example3 works, but didn't do the __new__ part. Added it in with the (Example3, cls) included like you did in Example2.
What does __new__ do exactly? I thought all classes started with __init__.

ingydegmar
Автор

Why __new__ of metaclass is a staticmethod? Isn‘t it an implicit classmethod?

blanky_nap
Автор

Wow! Just wow! You are a god of python. Wow! Wonderful explanation. In your example of GoodChild/BadChild the error was thrown when the class was being created so your metaclass only focused on the __new__ method, this got me wondering, I mean for abstract methods will the check be in the __call__ method instead of __new__? Cause when parent class has abstract methods the child class can still be created even when the abstract method is not defined and only throws error when creating an object of the child class

johnmoff
Автор

hi, how to run jupyter notebook inside terminal?

relaxingmuzics