static class methods in Python?

Michal Wallace (sabren) sabren at manifestation.com
Fri Feb 18 21:19:49 EST 2000


On 19 Feb 2000, Neel Krishnaswami wrote:

> I'd agree that the self.__class__.bar 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 "class.foo" would expand to "self.__class__.foo" (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... */


:)


Cheers,

- Michal
-------------------------------------------------------------------------
http://www.manifestation.com/         http://www.linkwatcher.com/metalog/
-------------------------------------------------------------------------





More information about the Python-list mailing list