Python: Yuck July 23, 2015
I really dislike Python
A short blog post about my experience with Python. I've been doing Python/Flask work for about a month. It's long enough to get some sense of the language. It's not long enough to feel "comfortable" in the language. Please read these comments as such.
My experience includes decades with C, C++, Objective-C, and Java. Years of Ruby. Nearly a decade of Scala. A year with Haskell. A couple of years with Clojure (my fist Lisp). I've also done JavaScript and Pascal and some other languages that I don't remember... oh and 6502 assembler and 68000 assembler and BASIC.
My net is the Python is a bunch of hacks on hacks that created a mis-shapen beast.
Syntax
Python syntax is supposed to be clean. It's not.
You need an explicit return
at the end
of a function. This is so
Java-like. No... you shouldn't need a return
statement. It's just noise and clutter.
The whole __something__
hack is just a hack.
Surrounding some symbol with some underscores gives
that symbol a magic meaning/purpose seems like a huge
cheat. If you want to add some syntax to a language,
add the syntax explicitly... and it's not like
Python lacks an abundance of stupid syntax.
Why have "mystring".contains("my")
when you
can create a whole new syntactic structure like
"my" in "mystring"
. Every new syntactic structure
increases a language's complexity non-linearly.
Adding random syntactic structures means that a developer
has to learn the structure rather than understanding
the common "look for a method in the class's documentation."
And list comprehensions... they are yet another syntactic wart. Yes
[x * y
for x in [1, 2, 3]
for y in [4, 5, 6]]
May look nice, but (1) in
means something different
here and there's another for
syntax that means
almost the same thing:
for x in [1, 2, 3]:
for y in [4, 5, 6]:
I wish I could yield something here like scala...
And list comprehensions are mis-ordered... are then front to back (like
the order of the nested for
statements or are they back to front (like
putting the thing that's being yielded up front)? Oh... they're both.
And hey, why not over-use in
-- it's a floor wax, a dessert topping,
a test, and a generator.
Annotations. Annotations are another language within a language. They are a poor substitute for macros. They are stupid and wrong. Just look at Java. But Python has them. Go Python... you just adopted another stupid construct. Yay!
I could go on... but...
If I want a dynamic language, Ruby is syntactically cleaner and feels like a scripting language.
If I want mis-placed opinionation, Java's an excellent choice. And it's got more libraries and excellent documentation.
If I want over-use of underscores, there's always Scala.
Python just seems to me to be a language that's adopted the worst syntax and constructs from other languages, but wraps itself in the arrogance of "it's so clean." It's not. Python is just a mess.
PS
I like Python's white-space as offset rather than { }
or
begin ... end
.