Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
WIP: use assignment expression in stdlib (combined PR) #8122
requested review from
Jul 5, 2018
The point of this PR is just to open discuss on coding style: discuss when assignment expressions are appropriate or not.
The discussion: "[Python-Dev] Assignment expression and coding style: the while True case":
"Let's say that the PEP 572 (assignment expression) is going to be approved. Let's move on and see how it can be used in the Python stdlib." :-)
I added the DO-NOT-MERGE label and "WIP" in the title. I don't want to merge this PR (at least, not as it is currently).
I feel like I'm being picky, but since this is about style recommendations... in e.g.
if (nlines := rawdata.count("\n", i, j)):
My understanding was that the outer brackets were only necessary/desirable when using as a compound expression e.g. amending this example to the contrived
if (nlines := rawdata.count("\n", i, j)) == 10:
Have I just misread the PEP or is the intended style for these to always parenthesis-wrap them, even when unnecessary? (Or, am I misinterpreting the intention of this pull...)
Edit: Another comment referred me to Tim Peter's mailing list comment and the section in the PEP about parentheses, so I guess this is just some artifact of whatever transform was applied to the code.