Eep...python And It''s Thousands Of Concantations.


thantik

Still Fresh
Joined
Oct 7, 2008
Messages
37
Come one come all and see the glories of python!
We have Python, Jython, CPython, Stackless Python, Unladen Swallow, PyPy, IronPython, Python.NET, PyVM, Vyper, Psyco...god only knows I'm missing about a thousand other iterations.

Ive just gotten finally to the point where Im getting into the GUI stuff of Python, and trying to lay out what works and what doesn't work and at this point Im *really* in a head-spin. What implementation of Python are we going to have in the pandora? - Anyone know?

Will ANY of these other python implementations be available or even compatible with the Pandora? I highly doubt all of them will since at least a couple of them use their own internal compilers, etc. I really like the fact at least that I can glue C into Python for intensive tasks (I've been told I can basically get 95% speed of C, without all the hassle of the actual coding of C if I play my cards right.)

Is it worth trying to delve into any of these other implementations or am I better off just using the standard Python, writing what I need to write, then coming back and optimizing (or even re-writing for a specific implementation)? I vaguely remember seeing someone say premature optimization is the devil, but I dont want to write shoddy code either.
 
Last edited by a moderator:
edit: There was a random quote here from a topic I didn't end up replying to. This forum is really weird about quotes, in a bad way.

1. Get a list of the ones that interest you
2. Figure out which ones are open-source
3. Mark regular Python as "already being worked on" and all the others as "possible"

I think regular Python is probably fine. It's written in, what, C? I don't think there's a huge advantage in using anything else, is there?

Edit: Here's my own Wikipedia research:
Python: Going to be there
Jython: Possible, not sure why you'd need it since we'll have standard Python
IronPython: Made for .NET. Unfortunately, there is a giant space cucumber that prevents the Pandora from running .NET or Mono, so this is totally impossible. >_> <_< Trust me.
Stackless Python: Looks neat, and it's open-source. Odds are someone will port it.
PyPy: Seems really bizarre, not very mature
Unladen Swallow: Eventually going to be merged into CPython, more of a development branch than anything.

I'd say just use standard Python.
For one thing, I think the language is the same, these different interpreters are simply just different interpreters, and I don't see a good reason to prefer any of them to the standard when the standard will be available on the Pandora.

Stackless, however, looks interesting.
 
Last edited by a moderator:
'lulzfish' said:
I think regular Python is probably fine. Its written in, what, C? I dont think theres a huge advantage in using anything else, is there?
Aparrently there is. Psyco can actually be a 2x, 3x, or in rare, extreme cases reported 100x speedup. But lucky for me its a drop-in library I can import as far as Im aware.

Unladen Swallow is Googles upcoming implementation and they expect to see a 5x improvement in python speed as well as making it MUCH more multi-thread friendly. It is open-source.
 
Last edited by a moderator:
The point is, these are all implementations. The language interface is supposed to be the same for each, so just learn standard Python and worry about faster interpreters later.
 
'ThantiK' said:
''''''''lulzfish'''''''' said:
I think regular Python is probably fine. Its written in, what, C? I dont think theres a huge advantage in using anything else, is there?

Aparrently there is. Psyco can actually be a 2x, 3x, or in rare, extreme cases reported 100x speedup. But lucky for me its a drop-in library I can import as far as Im aware.

Unladen Swallow is Googles upcoming implementation and they expect to see a 5x improvement in python speed as well as making it MUCH more multi-thread friendly. It is open-source.Psyco is x86 only. The Unladen people may port it to x86-64 or just make some improvements, since it's in their repo.

Unladen really is intended to be just a branch, not a fork. They try to get improvements pushed back into mainline CPython asap, some are already there.

Threads are seriously overrated and not that crippled in CPython. They work great for I/O bound code, you only get bad scaling with CPU bound code.

80-90% of time is spent in 10-20% of code. With Cython or just C and ctypes you can make extension modules containing your handful of slow functions. You get C speed and get away from the GIL.

Pyprocessing (multiprocessing in 2.6) is great for many things. Use wisely.

Jython and IronPython have no GIL. Jython is the more mature, but IronPython will also run, on Mono.

While neat, Stackless is not actively developed anymore, only developed for Eve Online. Main developer moved over to PyPy. Use generators or greenlets instead.

PyPy is amazing. Python written in RPython, restricted subset of python. Has a translator that produces code for various backends (C code, java bytecode, .net bytecode), does type inference and really cool things: stackless, futures, tainted objects, persistence, any GC.
Best part: automatically generates a JIT. 0.8x to 2.2x fast as CPython, much faster with JIT (still slower than psyco, but the JIT is being worked on).
Not quite ready for wide use yet.

Bottom line: use CPython. When you need speed, go for Cython or C+ctypes.
 
Last edited by a moderator:
Thanks a whole lot sindbad - This is probably what most were talking about when they said to just profile your python code and rewrite the hardcore parts in C for the speedup.

Back to coding again! - Thanks a ton!

*quick edit*
However, it does suck hardcore that Psyco isn't arm-compatible. ACK!! :eek:
 
Last edited by a moderator:
'ThantiK' said:
Thanks a whole lot sindbad - This is probably what most were talking about when they said to just profile your python code and rewrite the hardcore parts in C for the speedup.

Back to coding again! - Thanks a ton!

*quick edit*
However, it does suck hardcore that Psyco isn't arm-compatible. ACK!! :eek:
Unladen Swallow is supposed to be based on LLVM which has an ARM backend. It needs a little attention to get the most out of the latest ARM processors though. PyPy is supposed to have an LLVM backend also but that may be based on version 1.9 of LLVM which used a different file format than version 2 or better.
 
Last edited by a moderator:
Learn the standard, deviate only when necessary. That means use the basic Python until you find it incapable of something, then see if there are more suitable options. Sindbad already covered those.
 
CPython is Python. (They renamed it to be clear.)

Stackless is a neat offspring, mostly used by EVE Online I think, but not super well supported IIRC.

jeff
 
Back
Top