Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > python 3000 and removal of builtin callable

Reply
Thread Tools

python 3000 and removal of builtin callable

 
 
Mirko Zeibig
Guest
Posts: n/a
 
      01-04-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@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.
 
Reply With Quote
 
 
 
 
Nicolas Fleury
Guest
Posts: n/a
 
      01-04-2005
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
 
Reply With Quote
 
 
 
 
Nick Coghlan
Guest
Posts: n/a
 
      01-05-2005
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 | http://www.velocityreviews.com/forums/(E-Mail Removed) | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
subtle error slows code by 10x (builtin sum()) - replace builtin sumwithout using import? bdb112 Python 2 07-02-2011 03:13 AM
Making Non Callable Objects Callable exiquio Python 2 10-07-2008 06:02 PM
Re: [Python-Dev] [Python-3000] RELEASED Python 2.6a1 and 3.0a3 Paul Moore Python 0 03-01-2008 10:39 PM
Why would Webrick use 0.0.0.0:3000 instead of 127.0.0.1:3000 ? Curt Hibbs Ruby 1 12-18-2005 12:58 PM
Why would Webrick use 0.0.0.0:3000 instead of 127.0.0.1:3000 ? Curt Hibbs Ruby 2 12-18-2005 06:04 AM



Advertisments