[Python-Dev] (name := expression) doesn't fit the narrative of PEP 20 (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 26 06:34:29 EDT 2018
- Previous message (by thread): [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20
- Next message (by thread): [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Antoine Pitrou wrote:
Well, how do languages where assignment is an expression returning the assigned value make their REPLs work? I'm sure they don't inflict that on their users, so it's certainly a solvable problem.
I can't think of any such language that has a REPL offhand, but here's a possible solution:
x := expr # doesn't print anything
(x := expr) # prints the result
I.e. special-case a stand-alone assignment, but allow overriding that with parens if needed.
-- Greg
- Previous message (by thread): [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20
- Next message (by thread): [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]