Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'programmer': 0.03; 'subject:Python': 0.06; 'attribute': 0.07; 'correct.': 0.07; '*is*': 0.09; 'correct,': 0.09; 'explanation': 0.09; 'facts': 0.09; 'false,': 0.09; 'python': 0.11; 'bug': 0.12; 'wrote': 0.14; '24,': 0.16; 'behaviour.': 0.16; 'callable': 0.16; 'callable,': 0.16; 'callable.': 0.16; 'incorrect': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'saying': 0.22; 'him.': 0.24; "shouldn't": 0.24; 'question': 0.24; 'script': 0.25; 'post': 0.26; 'header:In- Reply-To:1': 0.27; 'point': 0.28; 'correct': 0.29; 'rest': 0.29; 'chris': 0.29; 'am,': 0.29; 'raise': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; "i'm": 0.30; 'getting': 0.31; '>>>>': 0.31; 'directly,': 0.31; 'object.': 0.31; 'programmers': 0.33; 'actual': 0.34; 'anybody': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'consistent': 0.36; 'otherwise.': 0.36; 'two': 0.37; 'starting': 0.37; 'being': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; '(from': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'read': 0.60; 'matter': 0.61; 'kind': 0.63; 'different': 0.65; 'details': 0.65; 'here': 0.66; 'natural': 0.68; 'stated': 0.69; 'legal': 0.71; 'hand': 0.80; 'delegated': 0.84; 'otten': 0.84; 'pardon': 0.84; 'absolutely': 0.87; '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=1WXbxIcZntQGqhrEUCDxCXdb3AvvMDgbI6ggJr4n/vU=; b=CUuj7niSnA/yKPcCnyvr+Tz6gBdr/yi86SjJUW4UUJac2LrVutqOS3u3vCVZDwLa5S Q1+NL+eul0K6DywZzgKE0auLkFhWFSFZ/z2fAmKmfQSzUERVJGyWHTEI14QQBDZ2IMpn AVy6lrmofbGl8u0maL8mcioAHSFjSJxvsUKWtPB2Qw9L8iTFBOYpflZt5Xy8kM65dMEi Cix3+jHngqCCHtXCW0ukfUBq0V9dknzK92W3/ffOVj3bADv5E474jtHlgbv70q2m+0Lu ESM3NB3GUAqWThh4/e2NVNSXm6DH8hnfP8jt4RS2FMFId4MjG2isjQJ8GF+jr7biwICo AVAg== X-Received: by 10.66.188.172 with SMTP id gb12mr512376pac.143.1385289944153; Sun, 24 Nov 2013 02:45:44 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <5291D536.4010606@rece.vub.ac.be> References: <5290C30D.5060604@rece.vub.ac.be> <5291D536.4010606@rece.vub.ac.be> From: Ian Kelly Date: Sun, 24 Nov 2013 03:45:02 -0700 Subject: Re: Behavior of staticmethod in Python 3 To: Python 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1385289947 news.xs4all.nl 15886 [2001:888:2000:d::a6]:50665 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:60359 On Sun, Nov 24, 2013 at 3:30 AM, Antoon Pardon wrote: > Op 23-11-13 22:51, Peter Otten schreef: >> Antoon Pardon wrote: >> >>> Op 23-11-13 10:01, Peter Otten schreef: >>> >>>> >>>> Your script is saying that a staticmethod instance is not a callable >>>> object. It need not be because >>>> >>>> Foo.foo() >>>> >>>> doesn't call the Foo.foo attribute directly, it calls >>>> >>>> Foo.foo.__get__(None, Foo)() >>> >>> I think you are burdening the programmer with implemantation details >>> that don't matter to him. >>> >>> IMO if Foo.foo() is legal then Foo.foo is callable. That the actual call >>> is delegated to Foo.foo.__get__(None, Foo) shouldn't matter. >> >> If you read the original post -- I think in this case the details do matter. >> >> What is your highlevel explanation for > > I don't care about what kind of explanation. I care about a correct answer to > the question whether a particular object is callable (from a programmers point > of view). I'm sure you can give a very comprehensive explanation for why in > this case we get an incorrect answer but that doesn't make the behaviour correct. > > Foo.foo() is legal here. So Foo.foo is callable. So you starting with it needn't > be callable is using "callable" with a different meaning than the natural > interpretation. Al the rest is just an attempt in getting others to accept your > use of "callable" instead of the natural one. > > Foo.foo() being legal and Foo.foo not being callable is IMO a bug in python. No matter > what explanation you have for the behaviour. Your supposition that Foo.foo is not considered callable by Python is false, as Chris already demonstrated, and I don't see where anybody here has stated otherwise. What Peter wrote was that "a staticmethod instance is not a callable object", which is absolutely correct, and these two facts are consistent because Foo.foo is not a staticmethod instance (Foo.__dict__['foo'] on the other hand *is* a staticmethod instance and *is not* callable, and Foo.__dict__['foo']() will correspondingly raise a TypeError).