The difference between "..." and "pass" is subtle. "Pass" is a null. It does literally nothing and takes no extra overhead. It is used specifically for methods (because they return nothing) where the devs have not done any code in the block. It's a placeholder that clearly indicates "we haven't gotten to this yet". On the other hand, an ellipse ("...") is an actual literal constant in Python (it's a singleton object of value "ellipsis"). This means you can use "return ..." at the end of a function because all functions must return something (or else they are methods), but if you haven't figured out what it needs to return yet then you can just "return ..." and the function will not throw a syntax error.
Note that if there is any shared computations for the payment types, you can put that code in the abstract method and call super in the concrete classes’ payment method. Idk about other languages, but in python, you can call abstract methods that are bound to ABCs from their concrete extensions in concrete sub classes.
The early examples are function overloading, not polymorphism. Also, technically, only classes have polymorphism.
2:39 That’s operator overloading, not polymorphism. Polymorphism is adding values of multiple types to a value of one type (i.e. string + string, string + list, string + bytes)
4:09 you can create the class without the abstract method, you just can’t instantiate from it.
Nunca había implementado polimorfismo de esa forma, sin duda con este video ahora entiendo mucho mejor como lo hacen las funciones que tienen esa característica
Dang, is English not your first language? Your English is really really good.
Thanks for the detailed explanation as you said in the intro I have been using this without knowing the name of it which surprised me. 🎉🎉
Everyone stressing about not having a job and and thinking of everything I can do with it!
well done in explaining the concept!
Please make a video about Composition and Inheritance.
PaymentType works better as a Protocol, in my opinion. But I can see why this wasn't used in the video
Thanks man!
i thought it was called "dependency injection"
This is just inheritance. Polymorphism means to extend the functionality, which is not being done here at all.
no it didn't doing f-string in VSC
What is meta class would you make a videos
It is so confusing! You must have called it static polymorphism.
Python is misspelt in the description😅
@eDRoaCH