Understanding Python: Abstract Base Classes
HTML-код
- Опубликовано: 31 мар 2023
- In this video, I go over abstract base classes.
Included in the lesson is how to create a basic abstract base class with abstract methods as well as the basis for a powerful plugin system.
As always, if you have any questions or suggestions for future videos, please leave a comment down below.
Follow me on twitter: / jakejcallahan
Source: github.com/JacobCallahan/Unde...
Timelapse music: 失望した by Eva
Link: • EVA - 失望した [Synthwave]...
Outro music: Elix by Synthness
Link: • Synthness - Elix ★ No ... Наука
If you find some great examples of ABCs in the wild, please reply to this comment with a link!
Can you explain how descripters in python works ?
I sure can. In fact, I'll move that up to be the subject of my next video.
You asked for it, so you got it!
ruclips.net/video/3QqURpf7Wjs/видео.html
@@JakeCallahancame here after your descriptor video.. you are a blessing... to stick to your word and getting it done so quick..
Looking forward to more of such great videos from you
I would just request one thing to start with a real life use case as to why we would prefer these concepts implemented before jumping on to how it works
@halfbakedthoughts4150 thank you for the kind words and feedback. I like to build up towards the more practical examples, but I can definitely see how showing practical could be motivational.
very nice explaination. Thanks!
Excellent tutorial, @JakeCallahan. You've covered the material beautifully, especially the "register" functionality. I've read the official docs and had no idea what it was talking about 😅. Now it's crystal clear! Thank you !!
great video! informative and easy to understand as usual! thanks!
Thank you so much.
Where does the plugin() in line 23 come from? I don't see it in this ServicePlugin class.
What's the difference between abstractmethod and abc.abstractclassmethod?
The second is used for methods decorated with @classmethod. If you're unsure what those are, check out my video in this playlist on Basic Classes.
@@JakeCallahan ah... so it's just @abstractmethod @classmethod in a single decorator
You're correct! However, abstractclassmethod was deprecated almost immediately after being introduced because they enabled the classmethod decorator to decorate an abstractmethod.
So to do this, just stack a classmethod decorator on top of the abstractmethod decorator.
@@JakeCallahan I see but seeing that you use it, I guess people still widely use the decorator?
While you can use it for now, it will be removed in the future, so best to avoid it.