Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #50500

Re: Callable or not callable, that is the question!

References <n6n2ba-ubg.ln1@satorlaser.homedns.org> <51df65f7$0$9505$c3e8da3$5496439d@news.astraweb.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2013-07-12 01:11 -0600
Subject Re: Callable or not callable, that is the question!
Newsgroups comp.lang.python
Message-ID <mailman.4616.1373613111.3114.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Jul 11, 2013 at 8:12 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Thu, 11 Jul 2013 15:05:59 +0200, Ulrich Eckhardt wrote:
>
>> Hello!
>>
>> I just stumbled over a case where Python (2.7 and 3.3 on MS Windows)
>> fail to detect that an object is a function, using the callable()
>> builtin function. Investigating, I found out that the object was indeed
>> not callable, but in a way that was very unexpected to me:
> [...]
>>      X.test2[0]() # TypeError: 'staticmethod' object is not callable
>>
>>
>> Bug or feature?
>
> In my opinion, a bug. I thought I had actually submitted it to the bug
> tracker, but apparently I was a shameful slacker and did not. However
> there was a discussion in this thread:
>
> http://mail.python.org/pipermail/python-dev/2011-March/109090.html
>
>
> Here's a simpler demonstration of the issue:
>
> assert callable(staticmethod(lambda: None))

If staticmethod is going to be callable then classmethod should be
callable also.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Callable or not callable, that is the question! Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-07-11 15:05 +0200
  Re: Callable or not callable, that is the question! Peter Otten <__peter__@web.de> - 2013-07-11 16:11 +0200
    Re: Callable or not callable, that is the question! Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-07-12 08:41 +0200
      Re: Callable or not callable, that is the question! Duncan Booth <duncan.booth@invalid.invalid> - 2013-07-12 07:36 +0000
        Re: Callable or not callable, that is the question! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-12 09:49 +0000
          Re: Callable or not callable, that is the question! Peter Otten <__peter__@web.de> - 2013-07-12 12:36 +0200
  Re: Callable or not callable, that is the question! Jason Swails <jason.swails@gmail.com> - 2013-07-11 10:28 -0400
  Re: Callable or not callable, that is the question! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-12 02:12 +0000
    Re: Callable or not callable, that is the question! Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-12 01:11 -0600

csiph-web