Does Python really follow its philosophy of "Readability counts"?
kyrie at uh.cu
Fri Jan 16 15:36:11 CET 2009
Quoting "Russ P." <Russ.Paielli at gmail.com>:
> On Jan 15, 12:21 pm, Bruno Desthuilliers
> <bdesth.quelquech... at free.quelquepart.fr> wrote:
> > Once again, the important point is that there's a *clear* distinction
> > between interface and implementation, and that you *shouldn't* mess with
> > implementation.
> If you "*shouldn't* mess with the implementation", then what is wrong
> with enforcing that "shouldn't" in the language itself?
Because, as a library user, it should be my power to chose when and how I
_should_ mess with the implementation, not the compiler, and definitely not you.
> So let's take the airplane example. Boeing and its contractors
> probably has hundreds of programmers working on millions of lines of
> code. If they believed you, they would abandon enforced data hiding,
> and programmers would have much more discretion to screw around with
> code that they don't work on directly. An FMS programmer could perhaps
> decide to change the parameters of the engine controls, for example.
I really hope that, at Boeing, they do a lot of unit tests and code reviews
before the code is commited. Messing with the internals wouldn't be the only bad
thing that could happen, you know... And I'd say that "x._private" where x is
not 'self', would be very easy to catch on those code reviews.
And, as someone else pointed out, even with 'strong' enforcement of data-hiding,
you can usually access the privates anyway - it's just a bit harder to do, and a
lot harder to discover.
You pointed out previously that Python wasn't up to the task of running
untrusted code on my own application, and I agreed. _That_ is what you seem
need, and enforced data hiding does very little towards it.
Facultad de Matemática y Computación, UH
More information about the Python-list