[Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

Antoine Pitrou solipsis at pitrou.net
Wed Apr 25 18:08:39 EDT 2018


On Wed, 25 Apr 2018 16:55:43 -0500
Tim Peters <tim.peters at gmail.com> wrote:
> 
> To my eyes, this is genuinely harder to follow, despite its relative brevity:
> 
>         while total != (total := total + term):

Does it even work?  Perhaps if the goal is to stop when total is NaN,
but otherwise?

> For that reason, the messages that sway me are those showing real
> code, or at least plausibly realistic code.  In the majority of those
> so far, binding expressions would be a small-to-major win.

I'm sure it's possible to find thousands of line of code where binding
expressions wouldn't be a win, but I'm not sure that would be a
constructive use of mailing-list bandwidth.

Regards

Antoine.




More information about the Python-Dev mailing list