[issue3214] Suggest change to glossary explanation: "Duck Typing"

Paddy McCarthy report at bugs.python.org
Wed Jul 2 07:27:13 CEST 2008


Paddy McCarthy <paddy3118 at users.sourceforge.net> added the comment:

Hi Georg,
A bit of relevant background about me: 
  I've been interested in Duck Typing _specifically_ for a couple of
years when I started watching edits to it on Wikipedia. I researched the
history of the use of the term and changed the attribution of first use
to Alex Martelli after digging in Google, and still trawl reading code
and articles on the subject. But I DONT think this makes me an expert -
Duck typing is a 'mould-able' term and the things we write about it help
to define it.

On your comment about hasattr:
  I think more and more that Duck-Typing is what allows us, (as in
Python), to substitute one class for another in a method previously
designed with only the other in mind - you know, as in the canonical
example of file-like objects such as StringIO substituting in methods
defined originally for files. In this case hasattr checks don't add
anything, and EAFP is all important.

I tried to get wider context on this by posting it originally to
comp.lang.python but no one was interested. I don't normally frequent
the developers forumbut maybe we should open the issue to that audience?

- Paddy.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3214>
_______________________________________


More information about the Python-bugs-list mailing list