I want to see all the variables

Paul Rubin http
Mon Jan 1 00:23:03 EST 2007


Steven D'Aprano <steve at REMOVE.THIS.cybersource.com.au> writes:
> > 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.
> 
> In my experience, it is mostly because they come from
> bondage-and-domination languages where it is expected that
> everything is private except for a small, carefully chosen public
> API, rather than from languages like Python that encourages openness
> and a philosophy of "we're all adults here".

Funny thing, some of those B&D languages were designed by people who
had plenty of experience with Lisp and were tired of being bitten by
its Python-like looseness.

> I wonder how many double-underscore "private" attributes are used in the
> Python standard library? That should give you an idea of "best practice"
> use of private attributes in Python.

If socket.py is an example of best practice use of private attributes,
I shudder to imagine what kind of cruft must lurk in legacy applications.



More information about the Python-list mailing list