Python and the need for speed
steve+python at pearwood.info
Thu Apr 13 22:13:03 EDT 2017
On Wed, 12 Apr 2017 07:56 pm, bart4858 at gmail.com wrote:
> The problem is also the language encouraging people to use high-level but
> inefficient methods, as the emphasis is on productivity and readability**
> rather than performance.
I'm sorry, but that is in no way "the problem".
Emphasising productivity and readability is not a problem. It is a feature.
There are a bazillion ugly, unreadable, unproductive but slow languages if
you want them:
C, C++, C#, Objective C, Lisp, Scheme, Fortran, Java, Rust, D, Ada ...
(although of course aficionados of each language will disagree about it
being unproductive; whatever rocks your boat). That's fine. If you want
fast code, you can get it.
Python's emphasis on readability and productivity is not a cross to bear, it
is not a bug, or a design mistake, or a problem. It is an intentional
While it is certainly true that faster Python is welcome, and that there may
be ways of getting it without giving up on the essential Pythonness of the
language, if speed is your number one concern, maybe Python was the wrong
choice of language for you.
Just like if you care most about program correctness, type-safety and
correctness proofs, choosing C is probably the wrong decision.
> (** Although I find code full of class definitions, one-liners, decorators
> and all the other esoterics, incomprehensive. I'm sure I'm not the only
> one, so perhaps readability isn't too much of a priority either.)
Classes and decorators are not esoteric. You sound like an old man who
complains about this new-fangled "telephone", and how things were so much
better when we had messenger boys to deliver messages anywhere in the city.
I'm not sure what you consider incomprehensible about "one liners", surely
it depends on what the one liner does. These are pretty clear to me:
# The archetypal "Hello World!" program is a one-liner.
# One liner to calculate the sum of the first 50 cubes.
total = sum(i**3 for i in range(50))
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
More information about the Python-list