Odd behavior with staticmethods

Scott David Daniels scott.daniels at acm.org
Sat Jul 1 21:38:30 EDT 2006


cmdrrickhunter at yaho.com wrote:
> ya know, I've searched for these "new classes" at least five times.
> I've heard all the wonderful things about how they make your life into
> a piece of chocolate with rainbows sprinkled in it.  Never once have I
> found a site that explains what syntax to use to make these new
> classes.

     http://www.python.org/doc/newstyle.html

 From the docs for the upcoming 2.5:

     http://docs.python.org/dev/ref/node33.html


As to how you make them:

     class Whatever:
         ...
is an old-style class.

     class Whenever(object):
         ...
is a new-style class.

     class Whoever(SomeClass):
         ...
is an old-style class if SomeClass is an old-style class,
and a new-style class if SomeClass is a new-style class.

--Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list