Global variables within classes.

Kevac Marko mkevac at
Tue Nov 27 23:54:05 CET 2007

On Nov 10, 8:39 pm, Marc 'BlackJack' Rintsch <bj_... at> wrote:
> Don't think so.  It's a surprise for many but then class attributes are
> not that common in code or they even use this "gotcha" for
> immutable default values.  As long a the value isn't changed the default
> value is just referenced from the class then and not every instance.

When changing default value, is there any way to change class
attribute and all referenced attributes too?

class M:
    name = u"Marko"

a, b = M(), M() = u"Kevac"
-> Marko Kevac Marko

Is there any way to get here -> Kevac Kevac Kevac ?
Or what is the right way of keeping global variables in classes?

More information about the Python-list mailing list