[issue36798] f-strings do not support top-level :=

2019-05-06 Thread Guido van Rossum
Guido van Rossum added the comment: PEP and docs have been amended. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue36798] f-strings do not support top-level :=

2019-05-06 Thread Guido van Rossum
Guido van Rossum added the comment: New changeset ae2c32f32b61f3b141ba4b0b1ad71781d2f9a1a1 by Guido van Rossum (Logan Jones) in branch 'master': bpo-36798: Updating f-string docs for := use case (GH-13107) https://github.com/python/cpython/commit/ae2c32f32b61f3b141ba4b0b1ad71781d2f9a1a1

[issue36798] f-strings do not support top-level :=

2019-05-06 Thread Logan Jones
Change by Logan Jones : -- keywords: +patch pull_requests: +13021 stage: needs patch -> patch review ___ Python tracker ___ ___

[issue36798] f-strings do not support top-level :=

2019-05-06 Thread Logan Jones
Logan Jones added the comment: I'm going to try to tackle this. I'm not exactly sure how to go about updating the PEP, but the docs should have a PR in the next 15 minutes or so. -- nosy: +Logan Jones ___ Python tracker

[issue36798] f-strings do not support top-level :=

2019-05-05 Thread Eric V. Smith
Eric V. Smith added the comment: I agree with Serhiy about the need to update PEP 572 to mention this. -- keywords: +easy stage: -> needs patch ___ Python tracker ___

[issue36798] f-strings do not support top-level :=

2019-05-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: And I think that PEP 572 should be updated too. This is a corner case that was omitted at initial consideration of the PEP. -- ___ Python tracker

[issue36798] f-strings do not support top-level :=

2019-05-05 Thread Eric V. Smith
Eric V. Smith added the comment: Because of the backward compatibility issues, I'm not going to change the f-string parser for this. We'll just need to document the requirements for using parens if you want to use :=. This is similar to the existing documentation about lambdas and f-strings

[issue36798] f-strings do not support top-level :=

2019-05-05 Thread Stefan Behnel
Stefan Behnel added the comment: FWIW, I think it's equally reasonable to allow assignment expressions directly in f-strings, as it is to require parentheses with a reference to the invalidity of top-level expressions. That makes me lean towards adding a parse-time error message that

[issue36798] f-strings do not support top-level :=

2019-05-05 Thread Emily Morehouse
Emily Morehouse added the comment: Ah yes, that's what I meant. I was thinking about the confusion between f-strings (evaluated immediately and stored as a string) vs other versions of string formatting which are evaluated when used. I've seen the mix of the two confuse people when

[issue36798] f-strings do not support top-level :=

2019-05-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: f-strings are defined and used at the same place, as any other expression. You can not save an f-string to a variable, as you can not save a multiplication. But you can save a string which is a result of the f-string evaluation. Perhaps you were fooled by

[issue36798] f-strings do not support top-level :=

2019-05-05 Thread Emily Morehouse
Emily Morehouse added the comment: My initial reaction is that named expressions should not be valid in f-strings and should instead raise an exception, the same way that using `a := 10` does. >>> a := 10 File "", line 1 a := 10 ^ SyntaxError: invalid syntax It could be expected

[issue36798] f-strings do not support top-level :=

2019-05-05 Thread Eric V. Smith
Change by Eric V. Smith : -- title: := breaks f-strings -> f-strings do not support top-level := ___ Python tracker ___ ___