[Python-ideas] Code version evolver

Steven D'Aprano steve at pearwood.info
Fri Mar 15 21:27:49 EDT 2019


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


-- 
Steven


More information about the Python-ideas mailing list