[Python-Dev] Re: 2.2a1: classmethod() and class attributes

Aahz Maruch aahz@rahul.net
Wed, 15 Aug 2001 08:07:29 -0700 (PDT)


Aahz:
> It's not particularly convenient for me to try out 2.2a1, so I'm just
> going by what's written.  One little hole that I don't see an answer to
> is what happens when you do this:
> 
> class C(object):
>     x = 0
>     def foo(cls):
>         cls.x += 1
>     foo = classmethod(foo)
> 
> C.foo()

Okay, after thinking about this a bit, I think that if the above code
requires __dynamic__=1 to work, then the default for __dynamic__ should
be changed.  I don't find the arguments about changing __class__ to be
particularly persuasive, but I think the above code *is* closely related
to standard Python idioms that should work by default.

+1 on changing __dynamic__ or at least enabling some kind of class
variable mutability by default.
-- 
                      --- Aahz (@pobox.com)

Hugs and backrubs -- I break Rule 6       <*>       http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista

I don't really mind a person having the last whine, but I do mind someone 
else having the last self-righteous whine.