why python annoys me

Douglas Alan nessus at mit.edu
Tue Apr 17 19:18:02 EDT 2001


Luke <floods at netplus.net> writes:

> Why should you have to name stuff with __*__ to get some pseudo
> hiding?  Or for any reason for that matter...

Using "__foo" to make "foo" private is no uglier than having to say
"private foo".  (Well, it really should have been one underscore, I
think, but that probably wouldn't have worked for historical reasons.)

> Why do you always have to access class data members as self.* What a
> pain in the ass, and anti-OO.

First of all, there's nothing anti-OO about it.  If you think so, then
you just don't really understand what OO is.  I don't find using
"self.foo" to be pain in the ass, and when I do, I can always reduce
it to "s.foo".  The alternative is often painful, if you ask me,
because then it can be hard to figure out where variables come from.
Are they local?  Are they global?  Do they come from the class?  From
the parent class?  Having to be more explicit about this can make code
more readable.

> Is it procedural or OO?

The two are not mutually exclusive.  Some OO languages have no
classes.  They have only prototypes and generic functions.  The Java
way is not the only OO way.  In fact, it's rather late to the OO
party.

> Some of the std lib seems to think it is OO, and the other half
> seems to think it is procedural...

Sometimes objects are best and sometimes procedures are best.

> I mean sometimes you create a new object with new, other times you
> just get a reference by calling a function.  Even Java is more
> object oriented than this--you *only* write classes, and the
> standard library is *only* made of objects.  Python gives too many
> ways of doing it.

In Java, you have static methods which are really just procedures.
Yet often these procedures are just stuck on some random class because
they have to go somewhere.  Is this supposed to be more elegant?

> Furthermore, the syntax and features of the language keep changing
> with every release.  For God's sake!  I regret ever buying
> programming python and learning python... I feel like they're
> already out of date.

Only new features are added.  Old features that you've come to love
and adore are almost never removed.

> There are lots of nice things about python like its built in [] and
> {} and I really like the indention, but I'm about to go back to
> Java, a language I know very well and feel comfortable in.

Well, that's what it really amounts to -- that you are "comfortable"
in it.  If you had come to Java from many other languages, you would
feel that Java was uncomfortable.  Take for instance, the fact that
Java has like 23 classes just for doing character i/o to a terminal.
What's up with that?  Python manages to do it with one or two?  Talk
about discomfort!

> I'm not slamming it, it has lots of potential, but there are so many
> stupid illogical features in Python that just ruin the whole
> experience.

Any new language requires some abount of patience.  Python makes more
sense than the vast majority of languages out there.  In fact, it
makes more sense than Java.

|>oug



More information about the Python-list mailing list