[Python-3000] callable()

Andrew Koenig ark-mlist at att.net
Tue Jul 18 20:25:58 CEST 2006


> Andrew Koenig wrote:


> > I note in PEP 3000 the proposal to remove callable(), with the comment
> "just call the object and catch the exception."

> I think that should be amended to "just use hasattr(obj. '__call__')
> instead". That's what callable() will become equivalent to once
> old_style classes are gone.

I am uncomfortable about exposing the implementation this way, if only
because it would require fixing the equivalence between callable() and
hasattr(obj, '__call__') for all time.  I much prefer the extra abstraction
layer that callable() provides.




More information about the Python-3000 mailing list