Calling private base methods

Duncan Booth duncan.booth at invalid.invalid
Sun Apr 15 14:41:33 EDT 2007


"Isaac Rodriguez" <isaac.rodriguez at comcast.net> wrote:

>> The fact that I had
>> to resort to this trick is a big indication of course that genuinely
>> private members (as opposed to a 'keep off' naming convention) are a bad
>> idea in general.
> 
> 
> The fact that you had to resort to this trick is a big indication that
> the library you were using is bad designed; it has nothing to do with
> private members being a bad idea. You were using a library which
> interface was in-complete (provided that you "genuinely" really needed
> to access the private member to do what you wanted to do).

I agree with that to a certain extent, but I've never found any situation 
where I gained any benefit because someone had made part of the 
implementation private, only ever found annoyance because someone had made 
something private which shouldn't have been.

The problem is that when people design interfaces they don't (and 
cannot) know all the situations in which the code is going to be used in 
the future. Clearly separating the published interface from the 
implementation details is a good thing, but physically preventing access to 
those details is IMHO a bad thing.



More information about the Python-list mailing list