Calling private base methods

Isaac Rodriguez isaac.rodriguez at comcast.net
Sun Apr 15 11:27:30 EDT 2007


> 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).

Private members is a great thing. They are the foundations of
encapsulation and object oriented design. The fact that Python allows
you to access "private" methods because the only "restriction" is the
name mangling does not mean you should access them and use them
directly.

I don't see the way private members are handled in Python a strenght
or a weakness of the language as compared to other languages. However,
I do see libraries that do not provide all the needed interface
methods as poor designed, or programmers that try to work around the
public interface of a class when it is not needed as poor programmers.

Thanks,

- Isaac.




More information about the Python-list mailing list