This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: async and await missing from token list
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: SilentGhost, docs@python, martin.panter, matrixise, python-dev, yselivanov
Priority: normal Keywords: easy, patch

Created on 2015-11-07 16:02 by SilentGhost, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
token.diff SilentGhost, 2015-11-07 16:02 review
issue25580.diff SilentGhost, 2015-11-13 07:10 review
issue25580_2.diff SilentGhost, 2015-11-13 18:36 review
Messages (15)
msg254281 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2015-11-07 16:02
With introduction of async and await tokens in 3.5 the token documentation needs updating.
msg254282 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2015-11-07 16:06
With python 3.5, async is a token with the ASYNC type.


>>> tokens = tokenize.generate_tokens(io.StringIO('async def foo').readline)
>>> pprint.pprint(list(tokens))
[TokenInfo(type=55 (ASYNC), string='async', start=(1, 0), end=(1, 5), line='async def foo'),
 TokenInfo(type=1 (NAME), string='def', start=(1, 6), end=(1, 9), line='async def foo'),
 TokenInfo(type=1 (NAME), string='foo', start=(1, 10), end=(1, 13), line='async def foo'),
 TokenInfo(type=0 (ENDMARKER), string='', start=(2, 0), end=(2, 0), line='')]
msg254334 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-11-08 11:29
I wonder if the new tokens need a “versionadded” notice. They were added in revision eeeb666a5365 for 3.5.
msg254542 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2015-11-12 18:04
I've added versionchanged, since this is what's done in os, for similar lists.
msg254559 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-11-12 21:34
Do you have a new version of the patch?
msg254580 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2015-11-13 01:03
ASYNC/AWAIT tokens are temporary and will be removed in 3.7
msg254589 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2015-11-13 07:10
Hm, not sure why the file didn't get uploaded, I clearly remember attaching it.

Yury, what is the implication for this issue? Are you suggesting that the note should state that these two are temporary? Or is this information available somewhere else, in What's new, for example?
msg254609 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2015-11-13 18:15
> Are you suggesting that the note should state that these two are temporary? 

Yes, that would be great.


> Or is this information available somewhere else, in What's new, for example?

Not directly, I think.  It was detailed to some extent in PEP 492.  In what's new of 3.5 & 3.6 it's stated that async/await will be keywords in 3.7.
msg254611 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2015-11-13 18:36
Here is the updated wording. I'm not familiar with other such cases in the stdlib, if any one knows of another similar case, I'd be glad to correct the language to match previous usage.
msg254631 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-11-13 22:58
Will they really be removed? What are the compatibility implications? Maybe it would be better to alias them to NAME, or keep them as unused values.
msg254632 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-11-13 23:04
My only background here is via the tokenize module, which seems to currently behave as described in <https://www.python.org/dev/peps/pep-0492/#transition-plan>: async and await are either NAME tokens (like ordinary identifiers and other reserved keywords) outside a coroutine definition, but they become special ASYNC and AWAIT tokens inside a coroutine.
msg256623 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2015-12-17 23:19
> My only background here is via the tokenize module, which seems to currently behave as described in <https://www.python.org/dev/peps/pep-0492/#transition-plan>: async and await are either NAME tokens (like ordinary identifiers and other reserved keywords) outside a coroutine definition, but they become special ASYNC and AWAIT tokens inside a coroutine.


Exactly.  And in 3.7 they will be NAME tokens in any context.  That's why I'm reluctant to document them atm.
msg256624 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2015-12-17 23:26
Ah, I see that issue25580_2.diff does exactly what I proposed.  I'm committing it.
msg256625 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-12-17 23:27
New changeset aa79b2a5b2e1 by Yury Selivanov in branch '3.5':
docs: Document ASYNC/AWAIT tokens (issue #25580)
https://hg.python.org/cpython/rev/aa79b2a5b2e1
msg256626 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2015-12-17 23:27
Thanks for the patch!
History
Date User Action Args
2022-04-11 14:58:23adminsetgithub: 69766
2015-12-17 23:27:28yselivanovsetstatus: open -> closed
type: enhancement
messages: + msg256626

resolution: fixed
stage: patch review -> resolved
2015-12-17 23:27:04python-devsetnosy: + python-dev
messages: + msg256625
2015-12-17 23:26:11yselivanovsetkeywords: + easy

messages: + msg256624
2015-12-17 23:19:03yselivanovsetmessages: + msg256623
2015-11-13 23:04:25martin.pantersetmessages: + msg254632
2015-11-13 22:58:22martin.pantersetmessages: + msg254631
2015-11-13 18:36:49SilentGhostsetfiles: + issue25580_2.diff

messages: + msg254611
2015-11-13 18:15:35yselivanovsetmessages: + msg254609
2015-11-13 07:10:18SilentGhostsetfiles: + issue25580.diff

messages: + msg254589
2015-11-13 01:03:04yselivanovsetmessages: + msg254580
2015-11-12 21:34:49martin.pantersetmessages: + msg254559
2015-11-12 18:04:06SilentGhostsetmessages: + msg254542
2015-11-08 11:29:29martin.pantersetnosy: + yselivanov, martin.panter
messages: + msg254334
2015-11-07 16:06:22matrixisesetnosy: + matrixise
messages: + msg254282
2015-11-07 16:02:19SilentGhostcreate