On Sat, Mar 16, 2019 at 12:28 PM Steven D'Aprano <st...@pearwood.info> wrote: > > On Fri, Mar 15, 2019 at 08:10:58PM +0100, francismb wrote: > > On 3/15/19 4:54 AM, Stephen J. Turnbull wrote: > > > Not really. For example, addition of syntax like "async" and "yield" > > > fundamentally changes the meaning of "def", in ways that *could not* > > > be fully emulated in earlier Pythons. The semantics simply were > > > impossible to produce -- that's why syntax extensions were necessary. > > But here, the code for versions before that change (e.g. aync) also > > worked on the new versions? there was not need to translate anything to > > the new version as it was a backward compatible change. To use the new > > feature you have to explicitly use that feature. If that so far correct? > > No, it is not a backwards compatible change. Any code using async as a > name will fail. > > py> sys.version > '3.8.0a2+ (heads/pr_12089:5fcd3b8, Mar 11 2019, 12:39:33) \n[GCC 4.1.2 > 20080704 (Red Hat 4.1.2-55)]' > py> async = 1 > File "<stdin>", line 1 > async = 1 > ^ > SyntaxError: invalid syntax
Though that particular case is a little complicated. Python 3.4.4 (default, Apr 17 2016, 16:02:33) >>> async def foo(): File "<stdin>", line 1 async def foo(): ^ SyntaxError: invalid syntax Python 3.5.3 (default, Sep 27 2018, 17:25:39) and Python 3.6.5 (default, Apr 1 2018, 05:46:30) >>> async def foo(): ... pass ... >>> async = 1 >>> Python 3.7.0a4+ (heads/master:95e4d58913, Jan 27 2018, 06:21:05) >>> async = 1 File "<stdin>", line 1 async = 1 ^ SyntaxError: invalid syntax So at what point do you call it a backward-incompatible change? And if you have some sort of automated translation tool to "fix" this, when should it rename something that was called "async"? ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/