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


Groups > comp.lang.python > #60357

Re: Behavior of staticmethod in Python 3

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!feeder2-2.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 <antoon.pardon@rece.vub.ac.be>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'python.': 0.02; 'programmer': 0.03; 'subject:Python': 0.06; 'attribute': 0.07; 'correct.': 0.07; 'explanation': 0.09; 'bug': 0.12; 'behaviour.': 0.16; 'callable': 0.16; 'callable.': 0.16; 'incorrect': 0.16; 'received:192.168.1.4': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'saying': 0.22; 'header:User-Agent:1': 0.23; '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; "doesn't": 0.30; "i'm": 0.30; 'getting': 0.31; 'directly,': 0.31; 'object.': 0.31; 'programmers': 0.33; 'actual': 0.34; 'but': 0.35; 'starting': 0.37; 'being': 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; 'natural': 0.68; 'legal': 0.71; 'delegated': 0.84; 'otten': 0.84; 'pardon': 0.84; 'received:195.238': 0.84; 'received:195.238.6': 0.84; 'received:belgacom.be': 0.84; 'received:isp.belgacom.be': 0.84
X-Belgacom-Dynamic yes
X-IronPort-Anti-Spam-Filtered true
X-IronPort-Anti-Spam-Result ApMBAPPUkVJbs/Xy/2dsb2JhbAANTL0sgwOBM4MZAQEBBHgRCxgJFg8JAwIBAgFFEwgCiAKtLYlih1AXjw4WhB0DmBSVOw
Date Sun, 24 Nov 2013 11:30:14 +0100
From Antoon Pardon <antoon.pardon@rece.vub.ac.be>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20131005 Icedove/17.0.9
MIME-Version 1.0
To python-list@python.org
Subject Re: Behavior of staticmethod in Python 3
References <l6povp$ndp$1@speranza.aioe.org> <l6pqs8$8b4$1@ger.gmane.org> <5290C30D.5060604@rece.vub.ac.be> <l6r7v6$mhj$1@ger.gmane.org>
In-Reply-To <l6r7v6$mhj$1@ger.gmane.org>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
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 <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3121.1385289032.18130.python-list@python.org> (permalink)
Lines 40
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1385289032 news.xs4all.nl 15917 [2001:888:2000:d::a6]:41767
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:60357

Show key headers only | View raw


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.

-- 
Antoon Pardon

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


Thread

Behavior of staticmethod in Python 3 Marco Buttu <marco.buttu@gmail.com> - 2013-11-23 09:28 +0100
  Re: Behavior of staticmethod in Python 3 Peter Otten <__peter__@web.de> - 2013-11-23 10:01 +0100
    Re: Behavior of staticmethod in Python 3 Marco Buttu <marco.buttu@gmail.com> - 2013-11-23 10:39 +0100
      Re: Behavior of staticmethod in Python 3 Peter Otten <__peter__@web.de> - 2013-11-23 16:23 +0100
    Re: Behavior of staticmethod in Python 3 Marco Buttu <marco.buttu@gmail.com> - 2013-11-23 10:39 +0100
  Re: Behavior of staticmethod in Python 3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-23 13:48 +0000
  Re: Behavior of staticmethod in Python 3 Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-11-23 16:00 +0100
  Re: Behavior of staticmethod in Python 3 Chris Angelico <rosuav@gmail.com> - 2013-11-24 08:38 +1100
  Re: Behavior of staticmethod in Python 3 Peter Otten <__peter__@web.de> - 2013-11-23 22:51 +0100
  Re: Behavior of staticmethod in Python 3 Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-11-24 11:30 +0100
    Re: Behavior of staticmethod in Python 3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-24 14:18 +0000
  Re: Behavior of staticmethod in Python 3 Peter Otten <__peter__@web.de> - 2013-11-24 11:43 +0100
  Re: Behavior of staticmethod in Python 3 Ian Kelly <ian.g.kelly@gmail.com> - 2013-11-24 03:45 -0700
  Re: Behavior of staticmethod in Python 3 Peter Otten <__peter__@web.de> - 2013-11-24 12:03 +0100
  Re: Behavior of staticmethod in Python 3 Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-11-24 16:55 +0100
  Re: Behavior of staticmethod in Python 3 Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-11-24 17:08 +0100

csiph-web