python 3000 and removal of builtin callable

Discussion in 'Python' started by Mirko Zeibig, Jan 4, 2005.

  1. Mirko Zeibig

    Mirko Zeibig Guest

    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.
    Mirko Zeibig, Jan 4, 2005
    #1
    1. Advertising

  2. 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
    Nicolas Fleury, Jan 4, 2005
    #2
    1. Advertising

  3. Mirko Zeibig

    Nick Coghlan Guest

    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 | | Brisbane, Australia
    ---------------------------------------------------------------
    http://boredomandlaziness.skystorm.net
    Nick Coghlan, Jan 5, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. exiquio
    Replies:
    2
    Views:
    541
    exiquio
    Oct 7, 2008
  2. bdb112
    Replies:
    2
    Views:
    300
    Chris Torek
    Jul 2, 2011
  3. Curt Hibbs
    Replies:
    1
    Views:
    237
    olof sivertsson
    Dec 18, 2005
  4. Curt Hibbs
    Replies:
    2
    Views:
    242
    Curt Hibbs
    Dec 18, 2005
  5. Ulrich Eckhardt
    Replies:
    6
    Views:
    107
    Peter Otten
    Jul 12, 2013
Loading...

Share This Page