>  > It seems to me that Wes is saying only that all function objects are
>  > callable, not that all callable objects are functions.
>
> Wesley said that function objects have a "heaping distinction" of
>  being callable. Only he can say for sure what that means; I took it to
>  mean that being callable is a very special property, perhaps one that
>  only function objects have. I just wanted to point out that there is
>  nothing really very special about that property, any more than being
>  iterable or having a length or a string representation or any of the
>  other properties that are implemented with special methods.


yeah, apologies for not going further to clarify... i was just
focusing on functions in my reply and could've mentioned the others
like classes, methods (regular, static, class), as well as any
instances of classes that have implemented __call__.  the point i was
trying to make is that most standard Python objects *aren't* callable,
so it does seem to be magic for newbies that functions are 1st class
objects and that a mere pair of parentheses can make them execute.

on a related note, currently in Python, there is a callable() Boolean
function that returns True if the object's callable and False
otherwise. this will be removed for Python 3.x because you can just
use hasattr(obj, '__call__').

cheers,
-wesley
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to