[issue30793] Parsing error on f-string-expressions containing strings with backslash

2019-05-06 Thread Eric V. Smith
Eric V. Smith added the comment: I'm going to close this. Either this problem is going to be addressed independently of this issue, or it's never going to be fixed. Either way, we don't need this issue to be open in order to come to a resolution. -- resolution: -> postponed stage:

[issue30793] Parsing error on f-string-expressions containing strings with backslash

2017-09-07 Thread Anselm Kiefner
Anselm Kiefner added the comment: Heh. I had a hunch it could be jupyter specific, but didn't test it. They had problems with f-strings before, it seems they over-fixed those .. Maybe you want to check their implementation and see if it's any good for a general solution? Otherwise I'd

[issue30793] Parsing error on f-string-expressions containing strings with backslash

2017-09-07 Thread Eric V. Smith
Eric V. Smith added the comment: That code is an error in Python 3.6: >>> f"{eval('bool(0)\ ... and True\ ... ')}" File "", line 3 SyntaxError: f-string expression part cannot include a backslash >>> I'm not sure it's a good idea that jupyter accepts code that's not valid in Python itself.

[issue30793] Parsing error on f-string-expressions containing strings with backslash

2017-09-07 Thread Anselm Kiefner
Anselm Kiefner added the comment: Hey Eric, just a heads up. In the latest jupyter notebook, this is valid code: f"{eval('bool(0)\ and True\ ')}" which returns 'False' I don't know how far you want to go, but if someone REALLY wants to use backspace in f-strings just for the sake of it -

[issue30793] Parsing error on f-string-expressions containing strings with backslash

2017-09-06 Thread Eric V. Smith
Eric V. Smith added the comment: I'm thinking that instead of supporting backslashes in general inside expressions, I'll just special case strings. So: f"{'\n' if foo else ''}" would be okay, but not: f"{a\ }" I think that would address the reason why \ was disallowed, but I'm going to have

[issue30793] Parsing error on f-string-expressions containing strings with backslash

2017-06-28 Thread Eric V. Smith
Eric V. Smith added the comment: The reason that this was done was to give us flexibility in deciding how the backslashes should be interpreted in the future. I announced it on python-dev here: https://mail.python.org/pipermail/python-dev/2016-August/145979.html. That message contains a link

[issue30793] Parsing error on f-string-expressions containing strings with backslash

2017-06-28 Thread Anselm Kiefner
New submission from Anselm Kiefner: Considering that x = 3 f"{'hello' if x == 3 else 'goodbye'} world" is a simple, elegant and powerful piece of code that works just as expected by itself, I often find myself stumbling and wondering why f"text {'\n' if x == 3 else ''} text" fails horribly