Hacker News new | ask | show | jobs
by myWindoonn 2958 days ago
CPython has always strived to be a simple easy-to-read reference implementation of Python. They have rejected many patches over the decades which would have sped up various things at the expense of readability.

People should not use CPython for speed; they should use PyPy for speed.

3 comments

The article did mention that Instagram's code wasn't much faster on PyPy.

I agree with you though; one of the interesting and good things about Python is that it's a standard not an implementation. Although CPython is the the most popular by usage, PyPy and Cython are mainstream alternatives (or superset in the case of cython). There's also Jython, IronPython, Unladen Swallow, Grumpy, and others that I can't think of now. Some of those are defunct and others only are Python 2. But the point is, competition is good.

Yes, or Cython or Nuitka.

And keep an eye on the (poorly named) Grumpy project (Python compiled to Go.)

http://cython.org/

https://nuitka.net/

https://github.com/google/grumpy

And it is simple. I haven't written C since college and it's mostly very readable, really great for exploration. In many ways, I agree that should be kept.

But memoizing lookups can be a single branch at the top of a few functions. We should strive to have our cake and eat it too, not simply declare we shouldn't bother.

It ain't that easy (cache invalidation is hard). But they did it anyway, so, yeah, you can have your cake and eat it.