Fredrik Lundh wrote: > Steve Holden wrote: > > >>To avoid naming conflicts, Python provides a mechanism (name mangling) >>which pretty much guarantees that your names won't conflict with anybody >>else's, *even if you subclass a class whose methods use the same name*. > > > as long as you don't cheat, that is: > > # your code > > class Secret: > def __init__(self): > self.__hidden = "very secret value" > > # my code > > from yourcode import Secret > > class Secret(Secret): > def gethidden(self): > return self.__hidden > > s = Secret() > print s.gethidden() >
I thought you'd know me well enough to know I'd *never* cheat :-) Nice way to point out that Pythin is indeed a "consenting adults" language. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.pycon.org -- http://mail.python.org/mailman/listinfo/python-list