Need instruction on how to use isinstance

Chris Rebert clp2 at rebertia.com
Mon Jun 28 00:47:23 EDT 2010


On Sun, Jun 27, 2010 at 9:30 PM, alex23 <wuwei23 at gmail.com> wrote:
> Stephen Hansen <me+list/pyt... at ixokai.io> wrote:
>> P.S. The removal of callable is something I don't understand in Python
>> 3: while generally speaking I do really believe and use duck typing, I
>> too have on occassion wanted to dispatch based on 'is callable? do x'.
>> Sometimes its not convenient to do so via duck typing. Its rare. But it
>> is there. That isinstance()/issubclass got a boost in power with the
>> ABC's and registering, while at the same time the ability to introspect
>> about the function-y callable-y ness of a function was removed? Makes no
>> sense to me. But alas!
>
> There's always: isinstance(<object>, collections.Callable)

Why in Guido's name is that in the collections module of all places?
What hath callability to do with container objects?

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list