On Jun 5, 2:27 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 5 Jun 2008 11:36:28 -0700 (PDT), "Russ P." > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > would need to use a "mangled" name to access private data or methods. > > But you will be using the name many times, you can reassign your own > > name, of course, so the mangled name need not appear more than once > > where it is needed. > > Which will break the first time the "innards" rebind a value to the > mangled name, as the "simplified" external name will still be bound to > the previous value.
I'm not sure you understood what I meant. In current Python, if I need access to data element __XX in class YourClass, I can use ZZ._YourClass__XX, but if I don't want to clutter my code with that mangled name, I can just write XX = ZZ._YourClass__XX and refer to it from that point on as XX. Obviously if the meaning of __XX changes within class ZZ, this will break, but that's why you are supposed to avoid using private data in the first place. -- http://mail.python.org/mailman/listinfo/python-list