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


Groups > comp.lang.python > #45673

Re: @staticmethods called more than once

References <02f0123d-2f9e-4287-b983-cfa1db9db69c@googlegroups.com>
Date 2013-05-21 10:39 -0500
Subject Re: @staticmethods called more than once
From Skip Montanaro <skip@pobox.com>
Newsgroups comp.lang.python
Message-ID <mailman.1926.1369150747.3114.python-list@python.org> (permalink)

Show all headers | 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