[Python-3000] PEP 3100 Comments

Fredrik Lundh fredrik at pythonware.com
Mon May 8 15:40:52 CEST 2006


Greg Ewing wrote:

>> A common Python idiom is to take different actions based on the capabilities
>> of an object rather than its type.
>
> I have no objection to that when the capability can be
> tested for easily and efficiently and without danger of
> causing undesirable side effects. But callability is
> not such a capability, therefore I think it's a bad
> idea to design an API which relies on being able to
> test for it.

it's spelled callable(), is successfully used in popular and well-designed API:s, is well-
defined in terms of duck-typing, and all counter-examples we've seen on this list are
utterly contrived.

(and even if you dig up one *real* example where false callable positives are a real
problem, I can assure you that there exists a trivial workaround for that specific case,
no matter what it is)

</F> 





More information about the Python-3000 mailing list