Timeline for How many types of polymorphism are there in the Python language?
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 10, 2016 at 16:51 | comment | added | gardenhead | @Walfrat Neither. The formal definitions of polymorphism is that an expression may have more than one type (hence the name!). You're referring to ad-hoc polymorphism, which is declaring multiple functions with the same name. This is not actually polymorphism, but it mimics it to a similar effect, hence the term "ad-hoc" (which isn't necessarily derogatory). | |
| Nov 10, 2016 at 16:12 | comment | added | Walfrat | I'm not sure, does the polymorphism standard definition allow the overrided function to be called without any code of our own (super.foo()) ? Or is just "changing the reference to another function with same prototype " is the (pedantic ?) definition of polymorphism ? | |
| Nov 9, 2016 at 18:17 | history | edited | gardenhead | CC BY-SA 3.0 |
added 142 characters in body
|
| Nov 9, 2016 at 18:15 | comment | added | gardenhead | @JimmyJames OK, I'm curious to see what you come up with. | |
| Nov 9, 2016 at 17:53 | comment | added | JimmyJames | I'll add an answer with an example of sub-type polymorphism in Python | |
| Nov 9, 2016 at 17:52 | comment | added | gardenhead | @JimmyJames Not in the usual sense. Any form of "sub-typing" in a dynamically-typed language is subsumed by duck-typing. | |
| Nov 9, 2016 at 17:41 | comment | added | JimmyJames | Python has types and sub-type polymorphism. What would lead you to think it doesn't? | |
| Nov 9, 2016 at 17:23 | comment | added | Pythonist | that's really healpful my doubt is clear , one more request can you please explain in brief in answer what is "duck-typing" it would be very helpful. | |
| Nov 9, 2016 at 16:44 | history | answered | gardenhead | CC BY-SA 3.0 |