Skip to main content

Home/ Mac Attack/ Group items tagged duck-typing

Rss Feed Group items tagged

Benjamin Bandt-Horn

How does polymorphism work in Python? - Stack Overflow - 0 views

  • idiomatic Python dictates that you (almost) never do type-checking, but instead rely on duck-typing for polymorphic behavior. There's nothing wrong with using isinstance to understand inheritance, but it should generally be avoided in "production" code
  •  
    idiomatic Python dictates that you (almost) never do type-checking, but instead rely on duck-typing for polymorphic behavior. There's nothing wrong with using isinstance to understand inheritance, but it should generally be avoided in "production" code
Benjamin Bandt-Horn

Function overloading in Python: Missing - Stack Overflow - 0 views

  • keyword arguments with default values can go a long way.
  • In Python, I think it's more accepted to use duck typing -- asking what an object can do, rather than what it is
  • it goes against the spirit of Python to worry a lot about what types are passed into methods
  •  
    keyword arguments with default values can go a long way.
1 - 2 of 2
Showing 20 items per page