On Sunday, February 20, 2011 10:34:19 PM UTC-5, rochacbruno wrote:
>
>
>>  Could you also use
>>>
>>> elif callable(locals().get(request.args(0)))
>>>
>>
>> Don't use callable(), as this is being deprecated
>>
>
> Actually, apparently it has just been resurrected in Python 3.2:
> http://docs.python.org/release/3.2/whatsnew/3.2.html#other-language-changes 
> (you'll
> have to scroll down a bit).
>

Nice! I did not know about it, I always avoid the use of callable because I
knew it was deprecated in python 3.

Thank you for the information!

But now, how to decide which is the better way?

hasattr( obj, '__call__') or callable(obj)

Reply via email to