Why less emphasis on private data?

Paul Rubin http
Mon Jan 8 08:49:21 CET 2007


Steven D'Aprano <steve at REMOVEME.cybersource.com.au> writes:
> Just how often do you inherit from two identically-named classes
> both of which use identically-named private attributes?

I have no idea how often if ever.  I inherit from library classes all
the time, without trying to examine what superclasses they use.  If my
subclass happens to have the same name as a superclass of some library
class (say Tkinter) this could happen.  Whether it ever DOES happen, I
don't know, I could only find out by examining the implementation
details of every library class I ever use, and I could only prevent it
by remembering those details.  That is an abstraction leak and is
dangerous and unnecessary.  The name mangling scheme is a crock.  How
often does anyone ever have a good reason for using it, except maybe
in something like a debugger that can just as easily reach inside the
actual class descriptors and get all the variables out?



More information about the Python-list mailing list