Why does python not have a mechanism for data hiding?
Paul Rubin
http
Mon Jun 2 20:11:16 EDT 2008
"Russ P." <Russ.Paielli at gmail.com> writes:
> I also realize, by the way, that Python allows a client of a class to
> define a new class member from completely outside the class
> definition. Obviously, that cannot be declared private.
This is bogus about 95% of the time though. For the cases where it is
really desired, I think it's best to require the target class to be
enable it specifically somehow, maybe by inheriting from a special
superclass. That could let the compiler statically resolve member
lookups the rest of the time.
More information about the Python-list
mailing list