Hi PyPy folks,
I've said so before in comments on your blog, but much kudos to the
project, you guys have been doing a great job! Some time ago I tried
PyPy against an artificial life experiment of mine which implemented a
simple stack-based language in Python and was pleasantly surprised to
see that PyPy actually sped things up quite a bit - I'd heard about the
JIT not being too good with interpreters. Good enough to make it a lot
faster, though. :)
Anyway, on to my question. I already asked it once in 2007, and didn't
get a very encouraging response, but we're years down the road now and
crazy difficulties is something the PyPy folks are good at, so I'll ask
it again.
You all are, as I understand, exploring supporting Python 3 with PyPy.
Cool.
Would it be possible to have an interpreter that could support both
Python 2 and Python 3 modules in the same runtime? I.e, an interpreter
that supports importing Python 3 code from Python 2 modules, and vice versa?
It would tremendously help the Python ecosystem for such a solution to
be out there, because in such a situation people can start using Python
3 codebases in Python 2, encouraging more people to port their libraries
to Python 3, and people can use Python 2 codebases in Python 3,
encouraging more people to start projects in Python 3. I can't stress
enough how much I believe that would help the Python ecosystem!
I understand that the problems involved would be decidedly non-trivial,
but that has never stopped you guys before.
Modules would need to declare somehow that they were Python 2 or Python
3. There'd need to be, somehow, two separate import "spaces", where
Python 2 code would import from Python 2 modules by default and Python 3
code would import from Python 3 modules by default. You'd also need
something explicit to allow cross imports. Python 2 objects represented
in Python 3 (and vice versa) would either need to be transformed for
immutable built-in objects (a Python 2 string would become a Python 3
bytes), or proxied for custom objects.
I remember when I brought this up at the time that Armin Rigo suggested
a few conundrums that were hard to solve. What these were exactly I
don't remember anymore, so I hope Armin will chime in and remind me. :)
Regards,
Martijn
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev