msg284010 - (view) |
Author: Kenzie Togami (Kenzie Togami) |
Date: 2016-12-26 01:16 |
IDLE doesn't highlight f-strings like r-strings or u-strings. See the attached screenshot. |
|
|
msg284051 - (view) |
Author: Ammar Askar (ammar2) *  |
Date: 2016-12-26 23:38 |
I've attached a patch that colorizes f-strings. The issue is marked as "test needed" which the dev guide says "... reporter should post a script or instructions to let a triager or developer reproduce the issue." Steps to re-create are to open an IDLE window and type in the code ``` f"123" F"123" u"123" ``` and notice the colorization difference. |
|
|
msg284062 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2016-12-27 05:05 |
New changeset a48cc85e5706 by Terry Jan Reedy in branch '3.6': Issue #29071: IDLE now colors f-string prefixes (but not invalid ur prefixes). https://hg.python.org/cpython/rev/a48cc85e5706 |
|
|
msg284064 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2016-12-27 05:20 |
There are 10 possible f-string prefixes, including combinations with r/R. See https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals While adding these, I noticed that IDLE was coloring now invalid ur prefixes and deleted those. I decided to test by modifying the existing human visual htest. Ammar: thank you for submitting a patch. It happens that I wrote my patch before I saw your submission. If I had seen yours first, I might have given you a chance to finish it. Feel free to try another IDLE issue. |
|
|
msg284065 - (view) |
Author: Ammar Askar (ammar2) *  |
Date: 2016-12-27 05:44 |
Not a problem, thank you for the encouragement. |
|
|
msg284420 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2017-01-01 06:35 |
The regular expression can be simplified using local flags: - stringprefix = (r"(\br|R |
u |
U |
msg284439 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2017-01-02 02:22 |
New changeset 62d3c0336df6 by Terry Jan Reedy in branch '3.6': Issue #29071: Use local flags for IDLE colorizer string prefix matcher. https://hg.python.org/cpython/rev/62d3c0336df6 |
|
|
msg284440 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2017-01-02 02:24 |
Thank you for the new feature (I presume) and its application. I disliked both writing and reading all the near duplication. I am posting this to python-list as an example of what the new feature is good for. |
|
|
msg284472 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2017-01-02 07:06 |
Thank you for advertising the new feature. Would you like to improve the documentation? It always was the hardest part to me. |
|
|
msg284479 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2017-01-02 12:34 |
The doc appears to be carefully accurate, but the second sentence especially is a bit awkward. I will open a new issue. |
|
|
msg291284 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2017-04-07 18:30 |
#29287 is about syntax highlighting the code within f-strings as code rather than as part of the string. |
|
|