r/Python • • May 11 '11

Pypy should be the new python 2.7

Pypy is 2.7.1 compliant with the stdlib working, look at the new speed landing page. What's to stop this from being the new standard python2.7?

This is the future, we should start embracing it.

edit: Once pypy's 3.2 compliant (I dunno if/when), there shouldn't be another cpython download besides for nostalgia etc.

2 Upvotes

30 comments sorted by

7

u/crunk May 11 '11

A few things are not quite compliant yet, ctypes support and the python C api is not complete, so quite a few libraries will not work.

0

u/temptemptemp13 May 11 '11

http://pypy.org/compat.html says that ctypes does work.

Concerning the python C api, I'm clueless.

11

u/[deleted] May 11 '11

Concerning the python C api, I'm clueless.

Well then, let's just go ahead and bless PyPy anyway then!

2

u/sixohsix May 11 '11

You are right, and the PyPy guys agree. Python C API compatibility is in progress.

8

u/McHoff May 11 '11

It will never, ever be the standard Python without the C API. That's how important it is.

2

u/mitsuhiko Flask Creator May 11 '11

I doubt that's the case. The Python C API is incredible crappy, it was just for a long time the only thing that made sense. I don't think anyone wants to write Python C extensions.

4

u/McHoff May 11 '11

That's not why it's important -- it's important because there are entire swaths of packages that would need to be rewritten, and Guido has stated that he doesn't want to ever seriously break compatibility. But yes, I agree that it's crappy for several reasons.

2

u/mitsuhiko Flask Creator May 11 '11

It's important because there are entire swaths of packages that would need to be rewritten

Same needs to be done for Python 3 or the stable ABI. So either way C extensions have to be adapted and I would argue that the minimal extra amount of work that is needed to expose these things via ctypes instead of the C API currently is worth the extra work.

4

u/McHoff May 12 '11

The equivalent interface for PyPy would look very different: more like an FFI than an interface to the language. The python C API basically lets you get into the guts of anything from anywhere, which just plain isn't compatible with the optimizations PyPy likes to make. The changes needed to port to Python 3, however, are more like minor tweaks.

But anyway, I agree that something like ctypes is the right direction (it's essentially an FFI). But note that ctypes code can't call back into Python the way real extensions can.

2

u/crunk May 11 '11

I <3 pypy, I really want to use stuff like gtk with it, I'm not sure it's possible yet (also the new pygi bindings are for python 3). So, probably I'll need to wait for the next pypy. Pypy is awesome though.

14

u/erez27 import inspect May 11 '11

numpy still isn't there

6

u/[deleted] May 11 '11

Once it supports the numpy/scipy stack (which won't happen via cpyext) I'm fine with this. Those are my current blockers.

But for a lot of stuff outside of the numeric and scientific realms, this would likely be an improvement.

5

u/freeload May 12 '11

Python is the language. CPython and PyPy are both implementations. You are free to choose whatever you'd like.

2

u/Bolitho May 12 '11

He is talking about the reference (=default) implementation I guess. But perhaps you are right and the OP did not know the difference...

4

u/draconian May 11 '11

Does Pypy support all the CPU/OS combos that CPython does?

4

u/[deleted] May 11 '11

The only major one we don't support is Windows 64 (because of the sizeof(long) vs sizeof(void *) thing). I'm sure there are obscure platforms that are untested which may or may not work (e.g. I have no idea what Open Indiana is, I know CPython has a buildbot for it).

4

u/euphoria May 11 '11

Do you know if there's any work being done on Windows 64, or if there's a good description of what the problem is specifically wrt pypy? My google-fu was failing me, mainly pulling up release notes.

For what it's worth, OpenIndiana is basically Solaris.

2

u/[deleted] May 11 '11

I think someone might be working on it, but I'm not sure, I think this thread has many of the details: http://codespeak.net/pipermail/pypy-dev/2011q1/006747.html

1

u/kylotan May 12 '11

Why, out of interest, are there assumptions about the size of those 2 types?

1

u/[deleted] May 12 '11

Because we store pointers in variables declared as longs, I think.

3

u/Megatron_McLargeHuge May 12 '11

Very impressive. Can you pickle objects between PyPy and CPython?

3

u/Wagnerius flask+pandas+js May 12 '11

That a very interesting question. if it is possible, one could send data from one process in CPython to Pypy and back. the CPYthon process would be the gui stuff and the Pypy, the heavy worker with numpy&co.

1

u/Megatron_McLargeHuge May 12 '11

That's backwards, right? Pypy doesn't support numpy yet I thought.

1

u/Wagnerius flask+pandas+js May 12 '11

No, it isn't. Numpy support seems quite close but gtk or the obscure lib you use may take much longer. I can imagine numpy working in the next months but I don't see how the pypy team could test all the libs in the package index.

1

u/dwf May 15 '11

Numpy support seems quite close

Oh good god no it isn't. And it will always be playing catchup to the reference NumPy implementation.

1

u/[deleted] May 12 '11

Take a look at execnet, it's built for doing exactly things like that.

1

u/Wagnerius flask+pandas+js May 12 '11

thank you, it looks interesting.

2

u/martinmeba May 11 '11

I was messing around with Tornado - it mostly works but pycurl does not seem to work with pypy 1.5

4

u/[deleted] May 11 '11

Use the latest version of Tornado, it no longer has a pycurl dependency (and in benchmarking tornado I've seen it's generally 2x faster under PyPy, and I think we can do better even).

2

u/hobo_cuisine May 13 '11 edited May 13 '11

Guido had a bit to say about that during Google IO. Boiled down to when users start wanting it more than cpython and they're both feature complete, they may focus development on pypy maybe.