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


Groups > comp.lang.python > #45677

Re: @staticmethods called more than once

Path csiph.com!usenet.pasdenom.info!gegeweb.org!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
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:skip:s 10': 0.07; 'arguments': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'received:184.172': 0.09; 'received:gator410.hostgator.com': 0.09; 'useless': 0.09; '~ethan~': 0.09; 'python': 0.11; 'argument.': 0.16; 'c/c++.': 0.16; 'confuse': 0.16; 'record,': 0.16; 'subclasses': 0.16; 'wrote:': 0.18; 'module': 0.19; 'basically': 0.19; 'header:User- Agent:1': 0.23; 'skip': 0.24; 'post': 0.26; 'gets': 0.27; 'header :In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'implicit': 0.31; 'class': 0.32; 'knows': 0.35; 'there': 0.35; 'method': 0.36; 'useful': 0.36; 'possible': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'called': 0.40; 'received:173': 0.61; 'first': 0.61; 'subject:more': 0.64; 'received:69.56': 0.68
Date Tue, 21 May 2013 09:30:22 -0700
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
MIME-Version 1.0
To python-list@python.org
Subject Re: @staticmethods called more than once
References <02f0123d-2f9e-4287-b983-cfa1db9db69c@googlegroups.com> <CANc-5UwztuXt6RYU1yQMrBOtMLyA32F2fYf6SF3iAxZ2bjwvAw@mail.gmail.com>
In-Reply-To <CANc-5UwztuXt6RYU1yQMrBOtMLyA32F2fYf6SF3iAxZ2bjwvAw@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - gator410.hostgator.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - stoneleaf.us
X-BWhitelist no
X-Source
X-Source-Args
X-Source-Dir
X-Source-Sender ([173.12.184.235]) [173.12.184.235]:47615
X-Source-Auth ethan+stoneleaf.us
X-Email-Count 5
X-Source-Cap dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ==
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.1928.1369155111.3114.python-list@python.org> (permalink)
Lines 11
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369155111 news.xs4all.nl 15939 [2001:888:2000:d::a6]:39408
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45677

Show key headers only | View raw


On 05/21/2013 08:39 AM, Skip Montanaro wrote:
> Don't confuse the use of "static" in Python with its use in C/C++.  From a post on StackOverflow:
>
>     A staticmethod is a method that knows nothing about the class or instance it was called on. It just gets the
>     arguments that were passed, no implicit first argument. It is basically useless in Python -- you can just use a
>     module function instead of a staticmethod.

For there record, staticmethod is useful when you want to make it possible for subclasses to change behavior.

--
~Ethan~

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


Thread

@staticmethods called more than once Christian <mining.facts@gmail.com> - 2013-05-21 08:26 -0700
  Re: @staticmethods called more than once Skip Montanaro <skip@pobox.com> - 2013-05-21 10:39 -0500
  Re: @staticmethods called more than once John Gordon <gordon@panix.com> - 2013-05-21 16:34 +0000
    Re: @staticmethods called more than once John Gordon <gordon@panix.com> - 2013-05-21 16:48 +0000
      Re: @staticmethods called more than once Christian <mining.facts@gmail.com> - 2013-05-21 10:17 -0700
  Re: @staticmethods called more than once Ethan Furman <ethan@stoneleaf.us> - 2013-05-21 09:30 -0700
    Re: @staticmethods called more than once 88888 Dihedral <dihedral88888@googlemail.com> - 2013-05-21 18:23 -0700

csiph-web