[Tutor] filling 2d array with zeros
steve at pearwood.info
Tue Sep 28 13:49:53 CEST 2010
On Tue, 28 Sep 2010 11:56:33 am Alex Hall wrote:
> > (But don't forget that Python is not necessarily written in C.
> > There's Jython, written in Java, and CLPython written in Lisp, and
> > many others. How they implement objects may be different. What
> > happens under the hood isn't important, so long as the behaviour at
> > the Python level remains the same.)
> Really? Neat! I wonder what the advantage of doing that is, since the
> end result, as you say, should be the same once you start writing
> Python code?
Different implementations can make different choices, to suit different
needs. So long as the end result is the same, they can choose different
mechanisms, different techniques, radically different strategies, or
simply choose a different implementation language because they can.
CPython is a conservative implementation written in ordinary C so that
it is available on almost any platform that has a C compiler.
Efficiency is not its primary goal, clarity of code and simplicity of
design is considered just as important. This is almost certainly the
version you are using.
Unladen Swallow is a version of CPython written by Google that aims to
speed up certain time-critical parts. If it works, it may end up being
merged with the regular CPython. Unfortunately, after a flash of
publicity and some promising early results, Unladen Swallow seems to
have gone quiet.
PyPy is a version of Python written in Python. It has an incredible
mission: to eventually produce versions of Python which are faster than
pure C, despite being written in Python itself. Although they have a
long, long way to go, they are making good progress, and PyPy can now
run Python code faster than CPython. PyPy is becoming a generalised
Just-In-Time compiler for high-level languages like Python.
IronPython and Jython are designed to integrate with Dot-Net and Java.
IronPython is probably written in C#, like most Dot-Net software, and
Jython is written in Java.
Stackless Python is similar to CPython except it doesn't have a function
call stack, which is good for certain specialist applications.
Pynie is an experimental version of Python written for the Parrot
virtual machine used by Perl 6.
CapPython is a restricted version of Python which aims to be much more
secure, allowing you to safely run untrusted code without it eating
And there are many more... I count at least 41 current or past Python
implementations, add-ons and related projects. My favourite (apart from
PyPy, which makes me feel all warm and tingly in that special place) is
# My first Like, Python script!
yo just print like "hello world" bro
I can't wait to put that on my resume :)
More information about the Tutor