> 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.



_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to