static class methods in Python?

Michal Wallace (sabren) sabren at
Sat Feb 19 03:19:49 CET 2000

On 19 Feb 2000, Neel Krishnaswami wrote:

> I'd agree that the you'd have to do in real Python
> is a little bit ugly. One thing I looked at doing was changing Python
> so the syntax "" would expand to "" (or
> whatever "self" actually is). This would solve the problem without
> adding a new keyword.

neat idea!

would "class" be a magic word that expanded to "self.__class__" ?
or would, for example, the class "Puppydog" use:

class Puppydog:
    def __init__(self):
        Puppydog.count = Puppydog.count + 1


> However, I was scared away by the following comment in Parser/pgen.c:
> 	/* This algorithm is from a book written before
> 	   the invention of structured programming... */



- Michal

More information about the Python-list mailing list