On Thu, 26 Apr 2018 08:38:51 +1000 Chris Angelico <ros...@gmail.com> wrote:
> On Thu, Apr 26, 2018 at 8:08 AM, Antoine Pitrou <solip...@pitrou.net> wrote: > > On Wed, 25 Apr 2018 16:55:43 -0500 > > Tim Peters <tim.pet...@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? > > Yes, it does, because the first "total" is looked up before the > rebinding happens. It's 100% unambiguous to the compiler... but still > pretty unclear to a human. And I think the multiple use of 'total' is > to blame for that. So I agree with Tim that this particular example is > better in longhand. "Better" is an understatement :-( Now that I understood it (thanks for the explanation), the shorthand version appears completely bonkers. Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com