msg259349 - (view) |
Author: Timo Furrer (tuxtimo) * |
Date: 2016-02-02 02:06 |
I had a look at the *Lib/keyword.py* module. It seems like the auto generated *kwlist* is missing the *await* and *async* keywords. At least according to https://www.python.org/dev/peps/pep-0492/ they are called *keywords*. The keyword module generates the *kwlist* from *Python/graminit.c*. |
|
|
msg259353 - (view) |
Author: Yury Selivanov (yselivanov) *  |
Date: 2016-02-02 02:56 |
`async` and `await` are only keywords in the context of an 'async def' function. It will be that way until Python 3.7. That said, I'm not sure what to do about the keywords module. Nick, Victor, thoughts? |
|
|
msg259354 - (view) |
Author: Martin Panter (martin.panter) *  |
Date: 2016-02-02 03:07 |
What happened in cases like “with” and “yield”, when these names were turned into reserved keywords depending on a __future__ statement? |
|
|
msg259771 - (view) |
Author: Raymond Hettinger (rhettinger) *  |
Date: 2016-02-07 09:19 |
It shouldn't go into keywords.py until it is actually a keyword. Keywords is used for many purposes including syntax highlighting and code analysis tools. |
|
|
msg259779 - (view) |
Author: Martin Panter (martin.panter) *  |
Date: 2016-02-07 10:38 |
To answer my question, it looks like the keywords.py list is automatically generated (by running the script) from Python/graminit.c, in turn generated from Grammar/Grammar. “Yield” and “with” were always listed even when the __future__ statement was needed to enable them (2.2 and 2.5). But currently ASYNC and AWAIT are in Grammar as what I believe are special tokens, rather than normal keywords. Depending on the purpose of the syntax highlighting or code analysis, it might be better for these to be listed as keywords now, rather than waiting until 3.7. |
|
|
msg261984 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2016-03-18 18:28 |
> Depending on the purpose of the syntax highlighting or code analysis, > it might be better for these to be listed as keywords now, rather than > waiting until 3.7. I agree, especially considering that it takes time before syntax highlighters update their keywords list and users update their syntax highlighters. Would this be doable, considering that the list is generated automatically? Are there any other downsides in doing it? |
|
|
msg316611 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2018-05-15 02:20 |
This is out-of-date for 3.5 and almost so for 3.6 and not an issue for 3.7. The PR has been closed. And I agree with Raymond that keywords.py should not anticipate the future. All this is aside from the auto-generation issue. |
|
|