What other languages use the same data model as Python?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu May 5 08:14:23 EDT 2011


On Wed, 04 May 2011 15:46:07 -0400, Benjamin Kaplan wrote:

> On Wed, May 4, 2011 at 3:22 PM, harrismh777 <harrismh777 at charter.net>
> wrote:

[...]
>>> Digging down into C should be unnecessary to explain Python.
>>
>>
>>   huh?   You have to be kidding. Why do you suppose we want it to be
>> open-sourced?   Use the force Luke, read the source.   If you really
>> want to know how Python is working you *must* dig down into the C code
>> which implements it.  The folks who document Python should be able to
>> tell us enough to know how to use the language, but to really 'know'
>> you need the implementation source.
>>
>>
> Reading the CPython sources will show you how CPython works under the
> hood, but it has nothing to do with how Python works. There are lots of
> things that CPython does that "Python" does not. For instance, the GIL
> is not a part of Python. Reference counting is not a part of Python.
> Caching small integers and strings is not a part of Python. Why not read
> the Jython sources instead of the CPython? It's the same language, after
> all.

More importantly, Python need not be implemented at all. If you're stuck 
on a desert island without electricity, you could simulate the effect of 
running any arbitrary Python code merely by understanding the semantics 
of high-level Python code, without caring the slightest about pointers at 
the C implementation level, or bit flipping at the hardware level, or von 
Neumann machines, or ref counting, or garbage collection, or any of a 
million other implementation details. All you need understand is the 
declared semantics of the language.

Surely I can't be the only one who sometimes tries to work out a tricky 
bit of Python code by hand-simulating it on pencil and paper?


-- 
Steven



More information about the Python-list mailing list