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


Groups > comp.lang.python > #60386

Re: Behavior of staticmethod in Python 3

Date 2013-11-24 17:08 +0100
From Antoon Pardon <antoon.pardon@rece.vub.ac.be>
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> <l6smbh$kel$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.3142.1385309418.18130.python-list@python.org> (permalink)

Show all headers | View raw


Op 24-11-13 12:03, 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.
> 
> Replacing "you" in your statement with "python" I was about to suggest to 
> make staticmethod(func) callable when I found this had already been 
> rejected:
> 
> [Python-Dev] Making staticmethod objects callable?
> Nicolas Fleury nidoizo at yahoo.com 
>  Wed Mar 1 15:57:12 CET 2006
> 
> https://mail.python.org/pipermail/python-dev/2006-March/061948.html
> 
> If you think you have compelling arguments, go ahead and explain them -- 
> preferably on python-ideas.

I am under no illusion that compelling arguments will make any difference.
People had argued for a ternary operator for years and it all fell on
deaf ears until finally a python developer was bitten by a nasty bug
while using one of the alternative that was always suggested here.

When you asked that python should behave following the principle of
least surprise and thus showed consistency where possible, the
standard trope was that a foolish consistency was the hobgoblin
of little minds.

I see no reason why this should go any way differently now.

-- 
Antoon Pardon

Back to comp.lang.python | Previous | NextPrevious 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