Why less emphasis on private data?
Mon Jan 8 04:37:07 CET 2007
Dennis Lee Bieber <wlfraed at ix.netcom.com> writes:
> I'd be quite concerned about the design environment rather than the
> immediate code... Probably need something ugly like...
> from mod1 import B as B1
> from mod2 import B as B2
> class A(B1, B2):
Interesting. I just tried that. mod1.py contains:
def foo(self): self.__x = 'mod1'
def bar(self): self.__x = 'mod2'
And the test is:
from mod1 import B as B1
from mod2 import B as B2
class A(B1, B2): pass
a = A()
Sure enough, mod2 messes up mod1's private variable.
More information about the Python-list