On Sun, Jun 27, 2010 at 9:54 PM, Stephen Hansen <me+list/pyt...@ixokai.io> wrote: > On 6/27/10 9:30 PM, alex23 wrote: >> Stephen Hansen<me+list/pyt...@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) > > What the hell? When did that show up? o.O (Did I not pay attention enough > during the ABC conversations? It seemed so boring). > > A) how is Callable a collection, in any way shape or form?
Completely agree, see my prior reply. > And B) does that > really return True for everything callable-esque? (I don't have a 3.x to > play with on this temporary computer) You don't even need 3.x; it was added in 2.6. The new magic of __instancecheck__ makes it possible. See http://docs.python.org/reference/datamodel.html#customizing-instance-and-subclass-checks Cheers, Chris -- Very cool new magic, eh? http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list