python 3000 and removal of builtin callable

Mirko Zeibig mirko-lists at zeibig.net
Tue Jan 4 04:40:54 EST 2005


Hello everybody,

I recently stumbled across the proposal of removing `callable` in Python 
3000 (http://python.org/peps/pep-3000.html) catching an exception 
instead, maybe something like this:
--- snip ---
[mize at lxmize mize]$ python2.3
Python 2.3.3 (#1, Apr  6 2004, 01:47:39)
[GCC 3.3.3 (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> i = 5
 >>> i()
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
TypeError: 'int' object is not callable
 >>>
--- snap ---

This is not an option for e.g. IDEs as some functions might actually do 
something when called ;-) and I like `callable` for introspection.

Other ways would be to check for the `__call__` attribute or use several 
methods of the `inspect`-Module, both of which are not better than 
`callable` IMHO.

Regards
Mirko
-- 
Insert a sig please.



More information about the Python-list mailing list