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

Russ P. Russ.Paielli at gmail.com
Tue Jan 20 21:25:42 EST 2009


On Jan 20, 5:16 pm, Mark Wooding <m... at distorted.org.uk> wrote:
> "Russ P." <Russ.Paie... at gmail.com> writes:
> > Rather than waste more time replying to your post, Let me just refer
> > you to an excellent post that you may have missed earlier in this
> > thread by Mr. D'Aprano:
>
> I've responded to that now.  (Steven and I can't even agree on a
> description for simple parts of Python semantics: why should we agree on
> this?)
>
> But I note that you've cunningly avoided responding to my remark that
> it's a mistake to conflate the module and class systems.  (I think only
> Common Lisp gets this right, because it can use its package system to
> manage the names of class and instance slots and generic functions.)
>
> Besides, it's not just classes that have internal parts.  Python is not
> Java: not all functionality is in classes.  The proposals I've seen do
> nothing for internal variables or functions at module level.
>
> -- [mdw]

I'm not sure what you mean by "conflating module and class systems."
Are you referring to the fact that Java requires each class to be in
its own file of the same name (I don't use Java, but that's what I've
heard)? If so, I agree that is a bad idea.

Actually, I remember reading years ago that Ada gets this right. I've
never used Ada for real work either, but I understand that privacy is
managed according to packages and modules rather than classes. That is
a more flexible approach and makes more sense.

[I realize that Ada is on life support, and I probably sound like a
neanderthal for bringing it up so much, but it actually has many
advanced features that were well ahead of their time -- and still are
to some extent.]

In any case, I have suggested that Python should perhaps get a new
keyword, "private" or "priv". When used inside a class, it would serve
a similar function to what it does in Java, C++, and Scala. If used at
the file scope, it could simply restrict the data or function to that
module. I think that is how Ada works.



More information about the Python-list mailing list