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


Groups > comp.lang.python > #45677

Re: @staticmethods called more than once

Date 2013-05-21 09:30 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: @staticmethods called more than once
References <02f0123d-2f9e-4287-b983-cfa1db9db69c@googlegroups.com> <CANc-5UwztuXt6RYU1yQMrBOtMLyA32F2fYf6SF3iAxZ2bjwvAw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1928.1369155111.3114.python-list@python.org> (permalink)

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