Should we start requiring "language_level=2" for .pyx files?
Hi, Python 3 is clearly taking over the world these days, so it starts feeling arcane to require Py2 syntax in .pyx files. Increasingly, it means that people cannot just rename .py files anymore to start optimising them, because the .py file has a high chance of being written in Py3 syntax. Eventually, we will have to switch to Py3 syntax by default in order to follow what most people are (or will be) used to. As a transition, I think we could start warning about cases where the language level is not set explicitly. If people start marking their code as being "Cython 2.x code", either with an in-file directive or from their setup.py, we will have less of a problem in the future to change the default. What do you think? Any other ideas, comments, objections? Stefan
It would help if cython could generate compiler warnings for a release or two about py2-specific constructs before officially switching the default language level. On Mon, May 28, 2018 at 2:14 PM Stefan Behnel <stefan_ml@behnel.de> wrote:
Hi,
Python 3 is clearly taking over the world these days, so it starts feeling arcane to require Py2 syntax in .pyx files. Increasingly, it means that people cannot just rename .py files anymore to start optimising them, because the .py file has a high chance of being written in Py3 syntax.
Eventually, we will have to switch to Py3 syntax by default in order to follow what most people are (or will be) used to.
As a transition, I think we could start warning about cases where the language level is not set explicitly. If people start marking their code as being "Cython 2.x code", either with an in-file directive or from their setup.py, we will have less of a problem in the future to change the default.
What do you think? Any other ideas, comments, objections?
Stefan _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel
On Mon, May 28, 2018 at 8:56 PM, Stefan Behnel <stefan_ml@behnel.de> wrote:
Hi,
Python 3 is clearly taking over the world these days, so it starts feeling arcane to require Py2 syntax in .pyx files. Increasingly, it means that people cannot just rename .py files anymore to start optimising them, because the .py file has a high chance of being written in Py3 syntax.
Eventually, we will have to switch to Py3 syntax by default in order to follow what most people are (or will be) used to.
As a transition, I think we could start warning about cases where the language level is not set explicitly. If people start marking their code as being "Cython 2.x code", either with an in-file directive or from their setup.py, we will have less of a problem in the future to change the default.
What do you think? Any other ideas, comments, objections?
Perhaps you could clarify something: I tried suggesting a while ago that Sage start using language_level=3 at least when actually building Sage on Python 3. I know this isn't necessary but it just seemed to make logical sense. But Jeroen was convinced it wasn't necessary because, according to him, language_level=3 doesn't really do anything. So what exactly does language_level=3 (or 2) do, such that it would impact porting Python 3 code to Cython?
Language level affects things like integer division (for example). I agree it makes sense to start putting a warning in. On Thu, May 31, 2018 at 7:35 AM, Erik Bray <erik.m.bray@gmail.com> wrote:
On Mon, May 28, 2018 at 8:56 PM, Stefan Behnel <stefan_ml@behnel.de> wrote:
Hi,
Python 3 is clearly taking over the world these days, so it starts feeling arcane to require Py2 syntax in .pyx files. Increasingly, it means that people cannot just rename .py files anymore to start optimising them, because the .py file has a high chance of being written in Py3 syntax.
Eventually, we will have to switch to Py3 syntax by default in order to follow what most people are (or will be) used to.
As a transition, I think we could start warning about cases where the language level is not set explicitly. If people start marking their code as being "Cython 2.x code", either with an in-file directive or from their setup.py, we will have less of a problem in the future to change the default.
What do you think? Any other ideas, comments, objections?
Perhaps you could clarify something: I tried suggesting a while ago that Sage start using language_level=3 at least when actually building Sage on Python 3. I know this isn't necessary but it just seemed to make logical sense. But Jeroen was convinced it wasn't necessary because, according to him, language_level=3 doesn't really do anything.
So what exactly does language_level=3 (or 2) do, such that it would impact porting Python 3 code to Cython? _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel
participants (4)
-
Erik Bray -
Nathan Goldbaum -
Robert Bradshaw -
Stefan Behnel