Rather than decorators, how about sections?

Steve dippyd at yahoo.com
Fri Aug 13 03:01:08 CEST 2004

Paul Morrow wrote:

>     class Foo(object):
>         staticmethods:
>             def baz(a,b):
>                 print "I'm a static method."
>             def bez(c,d):
>                 print "I'm a static method too."
>         classmethods:
>             def biz(klass):
>                 print "I'm a class method."
>         def __init__(self):
>             print "We all know what I am."

I don't.

Is there a simple primer for static and class methods 
and decorators and such that you can recommend?

I've looked at the URL you gave with the Memoize class 
but it assumes you already know what decorators are.

Then, later, Paul Morrow wrote:

 > Fine, instead of Foo (the name of the class), use 
the > word klass.  It's a popular name for the first
 > parameter of a class method.

"klass" isn't a word. It is a twee deliberate 
mispelling of a word.

It also runs the risk of causing confusion when code is 
spoken aloud (eg in actual human-to-human communication 
using alternating high and low pressure atmospheric 
waves to deliver packets of information, or in text 
readers for the blind).

It is bad enough when coders (including myself) choose 
to deliberately mispell words, but to make it required 
is unforgivable.

Any mispellings in the above post are deliberate, and 
are there to show the reader wonderful new ways of 
spelling old words.

More information about the Python-list mailing list