[Python-Dev] concerns regarding callable() method (original) (raw)
Andrew Koenig ark at acm.org
Sun Apr 8 15:58:12 CEST 2007
- Previous message: [Python-Dev] concerns regarding callable() method
- Next message: [Python-Dev] concerns regarding callable() method
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I have seen in PEP 3100 that callable() function is planned to be removed in Python 3000 with this replacement: "just call the object and catch the exception???". For one, the object (if it is callable) can raise exception itself, so you need to somehow to differentiate between exception raised inside its call and exception raised if object is not callable to begin with.
I seem to recall bringing up the same issue a while ago; at the time, the answer was that if you need it, you can write your own:
def callable(x):
return hasattr(x, '__call__')
My own preference would be for such queries to be defined abstractly as a built-in part of the language, but apparently my preference is out of sync with the community in this particular respect.
- Previous message: [Python-Dev] concerns regarding callable() method
- Next message: [Python-Dev] concerns regarding callable() method
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]