Inheritance and name clashes

Gary Herron gherron at
Sun Oct 3 23:17:13 CEST 2010

On 10/03/2010 01:07 PM, Rock wrote:
> 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
> functionality?
> 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?

No, you are correct.

But the philosophy of Python is   "We're all consenting adults here".

I won't willingly allow someone else to control what I have access to.  
And I assume that if I do step on something important, I'll figure it 
out during testing, long before releasing any code.

Gary Herron

> Please give me a hand on this one :)
> Rock

More information about the Python-list mailing list