I want to see all the variables

Tom Plunket tomas at fancy.org
Sun Dec 31 22:48:55 EST 2006


Steven D'Aprano wrote:

> What does the author of the original class know about *my* needs and
> requirements?

The only thing that the original class author might know is that mucking
with data marked private may well cause problems, and hiding it
therefore prevents those problems.

> It may turn out that accessing his "private" attributes is exactly what 
> I need to solve my problem.

It may also turn out that you /think/ that's what you need to do, but
actually need to do something different.

E.g. it may well be possible to access the bytes on the disk that holds
your database directly, and that may be "easier" than going through the
db API, but doing so may also be highly prone to error.

> I'm with the Python philosophy on this one: post all the "Don't Touch
> This" warning signs you like, but if somebody really wants to access my
> private attributes, to do something I never even imagined, they should be
> allowed to.

You are allowed to.  Have you been following the thread?  Your answer's
been mentioned several times.  At the same time, you should ponder very
carefully the reasons why the original author deemed it important to
make those attributes private in the first place.


-tom!

-- 



More information about the Python-list mailing list