Does Python really follow its philosophy of "Readability counts"?

Russ P. Russ.Paielli at
Sun Jan 25 02:17:55 CET 2009

On Jan 24, 4:17 pm, Luis Zarrabeitia <ky... at> wrote:
> Quoting "Russ P." <Russ.Paie... at>:
> > On Jan 23, 6:36 pm, Luis Zarrabeitia <ky... at> wrote:
> > > > Makes *no* sense? There's *no* good reason *at all* for the original
> > > > author to hide or protect internals?
> > > My bad, sorry.
> > > It makes sense... if the original author is an egotist who believes he
> > must
> > > control how I use that library.
> > If the original author provides you with the source code and the right
> > to modify it, he cannot possibly control how you use the library. You
> > can trivially disable any access controls. But for some reason that's
> > not enough for you.
> No, I'm not satisfied with forking python just to use sys._getframe.

Calling a one-word change a "fork" is quite a stretch, I'd say.

> > Has it occurred to you that some users might actually *want* access
> > controls? Maybe some users want to actually use the library as the
> > author intended it to be used. What a bizarre concept!
> Huh?
> Then... use it as the author intended. I am _not_ forcing you to use the
> obj._protected attributes!

But what if I want an automatic check to verify that I am using it as
the author intended? Is that unreasonable? Think of enforced access
restriction as an automatic "assert" every time an attribute is
accessed that it is not a private attribute.

I may want this automatic verification in my own code just for peace
of mind. More importantly, a project manager may want it to verify
that no one on the development team is accessing private attributes.
Sure, he could do that with code reviews, but code reviews are far
more expensive (and less reliable in some ways) than a simple check
enforced by the language itself.

Without enforced access protection, depending on code reviews to
detect the use of private attributes is a bit like depending on
security guards to keep doors closed without putting locks on the
doors. You don't need a lock on a door if you can afford to post a
security guard there full time, but doesn't it make more sense to put
a lock on the door and have a security guard check it only

More information about the Python-list mailing list