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!

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'url:pipermail': 0.05; 'detect': 0.07; 'bug.': 0.09; 'builtin': 0.09; 'function,': 0.09; 'issue:': 0.09; 'subject:question': 0.10; 'python': 0.11; 'bug': 0.12; 'callable': 0.16; 'callable,': 0.16; 'eckhardt': 0.16; 'stumbled': 0.16; 'tracker,': 0.16; 'typeerror:': 0.16; 'unexpected': 0.16; 'wrote:': 0.18; 'discussion': 0.18; 'thu,': 0.19; 'simpler': 0.24; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; 'apparently': 0.31; 'assert': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'subject:that': 0.31; 'url:python': 0.33; 'not.': 0.33; 'subject:the': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; '+0200,': 0.36; 'url:org': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'jul': 0.74; 'url :python-dev': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Gou20+Z6pKeR7oJBKI0KCAwSWTg8P8zu8m1a+4GJ4BI=; b=P4gPwL0mj2UrfjzSgneC53Pkj456v3D5EB5musTWEQRHV03HggxfOZ4VSy3narYB31 UQdQhEqpoYLwrHgS2fZf8pJJQnyuyekmnpmJGOeK1zjJgyc5swYtNmQfzH4qkvllfpta pNQCp2Jlnrr0pJE20rxtZYRK9c7R192SDc+vKJUdmp319HmwleTZoTSDXi+cxPjVr2Rd 2hFMWutx1x5M2xvaiyk7jtvN/4R+C8ZrK9PKAKSaW3RkrXl7pYIwSRgu1/bT8Wn3Bh0w wssV0+6QLilAu3sGiDBlCWmVzzbTtJRs2Cvl89cTowE2EgyWO7V+SA056lCjQA23VbYJ 3kEg==
X-Received by 10.66.139.227 with SMTP id rb3mr42231928pab.121.1373613102219; Fri, 12 Jul 2013 00:11:42 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <51df65f7$0$9505$c3e8da3$5496439d@news.astraweb.com>
References <n6n2ba-ubg.ln1@satorlaser.homedns.org> <51df65f7$0$9505$c3e8da3$5496439d@news.astraweb.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Fri, 12 Jul 2013 01:11:02 -0600
Subject Re: Callable or not callable, that is the question!
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4616.1373613111.3114.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1373613111 news.xs4all.nl 15979 [2001:888:2000:d::a6]:43479
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:50500

Show key headers only | 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