[Python-Dev] Re: Static method and class method comments
Donald Beaudry <firstname.lastname@example.org>
Thu, 26 Jul 2001 10:00:46 -0400
Paul Prescod <paulp@ActiveState.com> wrote,
> >Kevin Smith wrote:
> > I am very glad to see the new features of Python 2.2, but I do have a minor
> > gripe about the implementation of static and class methods. My issue stems
> > from the fact that when glancing over Python code that uses static or class
> > methods, you cannot tell that a method is a static or class method by looking
> > at the point where it is defined.
> > ...
> Agree strongly. This will also be a problem for documentation generation
> tools, type extraction tools and class browsers. I believe it would be
> easy to add a contextual keyword
> > class C:
> > def static foo(x, y):
> > print "classmethod", x, y
My favorite way to spell this is:
def foo(c, x, y):
print "class method", x, y
Or in words, class methods defined in their own name space, inside the
As for the distinction between "static methods" and "class methods", I
havnt been able to convince myself that it's useful.
Donald Beaudry Ab Initio Software Corp.
201 Spring Street
email@example.com Lexington, MA 02421
...So much code, so little time...