[Python-Dev] (name := expression) doesn't fit the narrative of PEP 20 (original) (raw)
Chris Angelico rosuav at gmail.com
Sat Apr 28 07:37:22 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 ]
On Sat, Apr 28, 2018 at 9:18 PM, Ned Batchelder <ned at nedbatchelder.com> wrote:
It's entirely true that binding expressions don't change this situation at all, EXCEPT that the entire point of binding expressions is to be able to express in one statement what used to take more than one. With binding expressions, actions may be coverage-hidden within one statement that without them would have been coverage-visible in more than one statement.
So far, all the examples in the PEP have the exact same coverage with and without assignment expressions, with a few exceptions where coverage is improved by them (where the alternative is to duplicate a function call). By combining multiple lines into one, we also ensure that all of it is executed exactly once, instead of having conditional execution.
ChrisA
- 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 ]