On Nov 10, 8:39 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> 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()
a.name = u"Kevac"
print M.name, a.name, b.name
-> 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?
--
http://mail.python.org/mailman/listinfo/python-list