Thomas Wouters wrote:

> Duck typing isn't "ask the object whether it can do this". Duck typing is
> "do this".

that's your own definition, by the way.  the usual definition is the one in the 
Python
tutorial:

    Duck Typing

    Pythonic programming style that determines an object's type by inspection
    of its method or attribute signature rather than by explicit relationship to
    some type object ("If it looks like a duck and quacks like a duck, it must
    be a duck.") By emphasizing interfaces rather than specific types, well-
    designed code improves its flexibility by allowing polymorphic substitution.
    Duck-typing avoids tests using type() or isinstance(). Instead, it
    typically employs hasattr() tests or EAFP [Easier to Ask Forgiveness
    than Permission] programming.

looks like you're confusing duck typing with EAFP.  don't do that; they may be
related, by they are two different things.

</F> 



_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to