Name mangling
ullrich at math.okstate.edu
ullrich at math.okstate.edu
Mon May 8 14:10:08 EDT 2000
I'm not going to tell you how long it took me to
figure out that the problem with
__foo = 42
class C:
def __init__(self):
self.value = __foo
c = C()
was inadvertent name mangling. (To be fair, the problem
arose in a slightly more complicated context. No, I'm
not going to say why I changed _foo to __foo in the first
place either.)
But usually when I don't get something it's because
I haven't found the right page in the docs. Here that's
not the case - I don't see how the bit in the docs about
name mangling says that the code above should not work.
???
DU
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list