By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,908 Members | 1,838 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,908 IT Pros & Developers. It's quick & easy.

python 3000 and removal of builtin callable

P: n/a
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@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.
Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Mirko Zeibig wrote:
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.


I totally agree with you. The callable function could be moved to a
module and be built-in, but it cannot really be removed. Calling a
callable and know if an object is a callable without calling it is
definitely not the same thing.

Regards,
Nicolas
Jul 18 '05 #2

P: n/a
Nicolas Fleury wrote:
Mirko Zeibig wrote:
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.

I totally agree with you. The callable function could be moved to a
module and be built-in, but it cannot really be removed. Calling a
callable and know if an object is a callable without calling it is
definitely not the same thing.


For many of the builtins to be "removed" in Py3k, I believe the actual intent is
to move them to a module (e.g. sys), with the removal being "remove from the
builtins", not "remove from Python".

Cheers,
Nick.

--
Nick Coghlan | nc******@email.com | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.