[Python-ideas] Length hinting and preallocation for container types

Stefan Behnel stefan_ml at behnel.de
Fri Mar 8 16:28:32 CET 2013


Christian Heimes, 05.03.2013 18:05:
> today I came across this slides
> https://speakerdeck.com/alex/why-python-ruby-and-javascript-are-slow by
> Alex Gaynor. The slides aren't some random rants on Python. Alex makes
> some valid points.

I just read through them. I'm ok with the first part, but when it comes to
the "why it's really slow" section, I get the impression that Alex has
misunderstood something about Python (and maybe programming languages in
general). There's no need to make "dynamic languages" C-ish, and why should
they be? We'll always be using more than one language for what we do, and
that's neither good nor bad, just normal. For the few cases (more than 5%?
Anyone?) where you really need to do zero-copy-whatever stuff or other
low-level-I-really-know-what-I-am-doing-kind-of-things, you can just write
them in a language that fits your use case and that allows you to do
exactly the kind of zero-copy or bits-here-and-there or immutable data
structures operations you need. That may or may not be C. It may be
Fortran, it may be Lua, it may be Haskell, it may be Lisp. It depends on
what you know and what you need. CPython has a well established reputation
as an extremely good and easy to use integration platform, and that's its
main selling point. Let's keep using it like that.

Stefan





More information about the Python-ideas mailing list