Terry J. Reedy added the comment:

I presume you would like 'async' and 'await' highlighted as keywords.  However, 
IDLE takes its definition of 'keyword' from keyword.kwlist.  'Async' and 
'await' are currently not on that list as they are not yet keywords.

>>> async = 1
>>> await = 2

According to https://www.python.org/dev/peps/pep-0492/#transition-plan, the 
intention was (is?) to make them keywords in 3.7.  As of Feb 11, that had not 
happened yet.  If and when it does, this issue will be taken care of.

I may consider adding a special context sensitive case for 3.6, if the 
colorizer code makes it easily possible.  Care is needed since it would be a 
mistake to mark them as keywords in the above statements.

The difficulty is that colorizer uses regexes and a bit of context sensitive 
code, while python is using a full grammar parse.  I believe that either at the 
beginning of a line and 'async' followed by 'for' or 'with' or 'await' not 
followed by certain punctuation ('.', ',', or '=') should be treated as a 
keyword.

Yury, does the rule above look about right?  'Await' seems trickier than 
'async'.

I think it may be possible to add regexes that are not literal words to the 
kwlist.  If so, adding 'async +def ', 'async +for ', 'async +with ', and 'await 
+[^.,=]' and not worrying about 'beginning or line' or tabs  (instead of 
spaces) between would be easy and probably good enough.

----------
nosy: +yselivanov
stage:  -> test needed
type: behavior -> enhancement
versions: +Python 3.7 -Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29706>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to