[Python-3000] PEP 3100 Comments
Talin
talin at acm.org
Sun May 7 08:23:05 CEST 2006
Greg Ewing <greg.ewing <at> canterbury.ac.nz> writes:
> Talin wrote:
>
> > 1) Getting rid of 'callable'.
> >
> > The reccomended replacement is "just call the object and catch the resulting
> > exception",
>
> No, the recommended replacement should be "redesign your API
> so that you don't need to test whether something is callable".
A common Python idiom is to take different actions based on the capabilities
of an object rather than its type. 'Duck Typing' is a special case of this, and
I think it's a fairly powerful technique (and deserving of more respect than
most language purists are willing to grant it.)
-- Talin
More information about the Python-3000
mailing list