Robert Bradshaw, 13.03.2010 21:07: > On Mar 13, 2010, at 5:30 AM, Stefan Behnel wrote: >> a) compatibility with Py2 code (-> when compiling .py files) >> b) compatibility with Py3 code (-> .py files + "-3" option or >> "cython3") >> c) the Cython language (-> .pyx files) >> >> We don't currently care about the file extension, for example. >> Should we generally stop supporting the 'cdef' keyword in .py files? > > The only place that the extension currently matters is that with a .py > file, signatures and other declarations don't have to match what they > are in the .pxd file (the ones from the .pxd file get pulled over). > This may result in compile time errors, when renaming a .py file to > a .pyx file, which I'm OK with, but we should definitely avoid any > behavioral changes due to changing the file extension.
The only reason why a user would choose the .py extension is because the code should work also in plain CPython, i.e. purely pure mode. So, what I meant was: when compiling a .py file, we should keep Cython specific syntax (especially keywords) out of the way, so that Cython can compile as much Python code as possible. I agree that it shouldn't result in any semantic differences for Python constructs. > The -3 option would be completely orthogonal to the file extension, > and could be used with both .py and .pyx files. Makes sense. >> I think we need to do that if we really want to introduce a well >> defined notion of "language level compatibility". > > What I want is that Cython is a superset of Python. In particular, for > widespread use it should be safe (barring bugs) to just compile a .py > file and run it. I don't think our "language level compatibility" > needs to be more granular than Py2 (meaning specifically 2.6, or maybe > 2.7) and Py3 (meaning 3.1?), at least not right now (there are bigger > fish to fry). Ok, let's assume that most Py3 syntax that we support will make it into Py2.7 anyway, so targeting something close to 2.7 should work. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
