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


Groups > comp.lang.python > #45673

Re: @staticmethods called more than once

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <skip.montanaro@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:skip:s 10': 0.07; 'arguments': 0.09; 'decorator': 0.09; 'useless': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'argument.': 0.16; 'c/c++.': 0.16; 'confuse': 0.16; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'mean,': 0.16; 'sender:addr:gmail.com': 0.17; 'module': 0.19; 'basically': 0.19; 'cc:addr:python.org': 0.22; 'skip': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'post': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'implicit': 0.31; 'class': 0.32; 'knows': 0.35; 'received:google.com': 0.35; 'method': 0.36; 'skip:& 10': 0.38; 'skip:& 20': 0.39; 'called': 0.40; 'first': 0.61; 'subject:more': 0.64; 'to:addr:gmail.com': 0.65
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=39V5Mu+aCVVcT+KupVpxHtmnJhIxHqvzox4qo3mrpT8=; b=MxtVufIEBAfTsWBJhNkP+JZhQAJZrt5n0A3rJQ5aMUhXQAE7gLNVnGsLEudnn/+ASi TB6YRdy7pHv4QeBFXurpMw3N1sheQUknMmq/9SGyxillePmjW7NSMdK5PojO9IHSFwbf w7o6PQuzvxhdDg8znUuZaK1cRSx/FaKYGulyb6QknElm2WqQ1Vv84O+o9nU1f2NZ+KK7 O3c57TqXvN+67/0jXwNwHd2ekvY4uPcZa6gISLUsorIKUi7cnsxYXRUEAL16SNDz/Tl7 TZf5BTbMfxtGWEkJLk/fSbNVKgJt3qE+cJYpklGGLoHi7cqF7LA95Z7BlJRuWeXgGbzH 2YvQ==
MIME-Version 1.0
X-Received by 10.50.27.37 with SMTP id q5mr8232006igg.52.1369150743915; Tue, 21 May 2013 08:39:03 -0700 (PDT)
Sender skip.montanaro@gmail.com
In-Reply-To <02f0123d-2f9e-4287-b983-cfa1db9db69c@googlegroups.com>
References <02f0123d-2f9e-4287-b983-cfa1db9db69c@googlegroups.com>
Date Tue, 21 May 2013 10:39:03 -0500
X-Google-Sender-Auth cRa1xT2Nb-Gk9nvvZRgbhX7xNZg
Subject Re: @staticmethods called more than once
From Skip Montanaro <skip@pobox.com>
To Christian <mining.facts@gmail.com>
Content-Type multipart/alternative; boundary=047d7b10c837bc364a04dd3c3f26
Cc python-list@python.org
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.1926.1369150747.3114.python-list@python.org> (permalink)
Lines 42
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369150747 news.xs4all.nl 16008 [2001:888:2000:d::a6]:41259
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45673

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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.


That is, the "@staticmethod" decorator doesn't mean, "call this function
once."

Skip

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