python's OOP question

Fredrik Lundh fredrik at pythonware.com
Wed Oct 18 04:24:35 EDT 2006


neoedmund wrote:

> ivestgating the web, i found something similiar with my approch:
> http://en.wikipedia.org/wiki/Duck_typing
> "Duck-typing avoids tests using type() or isinstance(). Instead, it
> typically employs hasattr() tests"

that's not entirely correct, though: in Python, duck-typing typically 
uses "Easier to Ask Forgiveness than Permission" (EAFP), aka "Just Do 
It", rather than "Look Before You Leap" (LBYL).

</F>




More information about the Python-list mailing list