What is Polymorphism in Python?

preview_player
Показать описание
In today’s video we’re going to be learning about Polymorphism in Python. Note that polymorphism is not exclusive to Python, and that the concepts you will learn in this video practically apply to every programming language.

▶ Become job-ready with Python:

▶ Follow me on Instagram:
Рекомендации по теме
Комментарии
Автор

I was trying to sign up for your classes but I couldn't find the IOU option

eDRoaCH
Автор

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.

dirtydevotee
Автор

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.

DrDeuteron
Автор

The early examples are function overloading, not polymorphism.
Also, technically, only classes have polymorphism.

asagiai
Автор

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)

danielputter
Автор

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. 🎉🎉

oromogamer
Автор

Dang, is English not your first language? Your English is really really good.

modmitch
Автор

4:09 you can create the class without the abstract method, you just can’t instantiate from it.

DrDeuteron
Автор

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

odiio
Автор

Please make a video about Composition and Inheritance.

andrzejsotys
Автор

Everyone stressing about not having a job and and thinking of everything I can do with it!

Vassimau
Автор

PaymentType works better as a Protocol, in my opinion. But I can see why this wasn't used in the video

ChongFrisbee
Автор

What is meta class would you make a videos

afgfuturetube
Автор

i thought it was called "dependency injection"

miguelvasquez
Автор

This is just inheritance.

Polymorphism means to extend the functionality, which is not being done here at all.

JarheadCrayonEater
Автор

no it didn't doing f-string in VSC

Pawlo
Автор

Python is misspelt in the description😅

nemoshu
Автор

It is so confusing! You must have called it static polymorphism.

mr-john-smith
visit shbcf.ru