[Python-Dev] PEP 3003 - Python Language Moratorium

Michael Foord fuzzyman at voidspace.org.uk
Thu Nov 5 11:18:17 CET 2009


Stefan Behnel wrote:
> Michael Foord, 05.11.2009 10:13:
>   
>> Stefan Behnel wrote:
>>     
>>> if it's intended to name the major
>>> implementations, I wonder why Cython is missing from that list.
>>>       
>> Is Cython an implementation of Python?
>>     
>
> We certainly aim for Python compatibility. That's a proclaimed 1.0 goal.
> Not sure if that means Py3 or Py2 syntax, but that's just a parser detail,
> after all.
>
>   

Right, but I think the main point is that Cython is not an 
implementation of Python. It uses Python syntax, calling into the Python 
runtime for many of its features, and *extending* Python syntax for 
compilation to C. (Right?)

Obviously a grey area - but if you take Cython code and try to run it on 
ClassicPython then you are likely to have syntax errors. The same is not 
true of the other full implementations (although where they use native 
platform features you may not have the same libraries available - but 
the language is unchanged).

All the best,

Michael

>   
>> It's a grey area, but it seems like Cython is a "Python inspired"
>> language (similar to Shedskin) rather than an implementation of Python:
>>
>>    The Cython language is very close to the Python language, but Cython
>> additionally supports calling C functions and declaring C types on
>> variables and class attributes. This allows the compiler to generate
>> very efficient C code from Cython code.
>>
>> (From http://www.cython.org/ )
>>     
>
> Cython is different from Shedskin because Shedskin /requires/ the 'Python'
> code to be static. Cython does not. It /optimises/ static code, but it will
> not complain about dynamic code.
>
> It /does/ make some static assumptions in that it considers builtins true
> builtins. However, it does not prevent you from replacing them in your
> code, as long as you do it inside the module. Certainly a restriction
> compared to Python, where you can import a module into a changed dict
> environment that redefines 'object', but not a major restriction IMO, and
> certainly not one that impacts much code.
>
>
>   
>> There are several partial implementations, including Python inspired
>> languages, but if we are looking at 'major complete implementations'
>> then the current list seems to be: CPython, Jython, IronPython and PyPy.
>>     
>
> Cython certainly is not a complete implementation, sure. It still lacks
> support for local classes, for example, metaclasses aren't handled, and
> generators are still in design stage. But if one of the goals of the
> moratorium is to let implementations catch up with the syntax, then Cython
> is certainly in line with that. I doubt that there will be much left on the
> TODO list two years from now.
>
>
>   
>> Even Unladen Swallow is a fork (sorry - I mean branch) of CPython rather
>> than a separate implementation.
>>     
>
> Cython is somewhere in the middle. It's not a fork or branch. Rather, it
> depends on the normal CPython runtime for certain features, such as the
> standard library, the type/object implementation, garbage collection, and a
> couple of dynamic features. But that doesn't prevent it from compiling your
> module into an executable application.
>
> Stefan
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk
>   


-- 
http://www.ironpythoninaction.com/



More information about the Python-Dev mailing list