Inheritance and name clashes
rocco.rossi at gmail.com
Sun Oct 3 22:07:00 CEST 2010
Hi all :)
I've really been wondering about the following lately. The question is
this: if there are no (real) private or protected members in Python,
how can you be sure, when inheriting from another class, that you
won't wind up overriding, and possibly clobbering some important data
field of the parent class, which might compromise its entire
I mean, nevermind the double underscore business, I know all about it.
But, honestly, not everybody uses that, so you can't really be sure
about what you're doing, right? Maybe the author forgot to warn about
some special member in the docs for instance, or even worse, it's a
third-party library, perhaps with no source! So how can you be sure???
The way I see it ... you can't!
Am I wrong?
Please give me a hand on this one :)
More information about the Python-list