On Sat, Feb 6, 2021 at 6:08 AM Paul Sokolovsky <[email protected]> wrote:
> And looking back now, that seems like intentionally added accidental
> gap in the language (https://en.wikipedia.org/wiki/Accidental_gap).
> Similar to artificially limiting decorator syntax, which was already
> un-limited. But seems, there're no "lessons learned", and there's now
> need to wait a decade again before fixing that?
Lesson learned: Early limitations ARE easily lifted, so it's still a
good idea to limit them until we've seen how they get used in
practice. :)
> > The principal a.e. use in conditional expressions is testing for
> > non-nullness. Your
> >
> > > while ((a1, b1) := phi([a0, a2], [b0, b2]))[0] < 5:
> > > a2 = a1 + 1
> > > b2 = b1 + 1
> >
> > is an unusual and very specific use.
>
> Well, many people were thinking (and I bet still think) that ":="
> itself is very unusual case. But if it's in, why not make it consistent
> with the assignment statement and unleash the full power of it?
TBH I don't think I'm understanding the use-case here, because it
looks like it'd work just fine with fewer variables and a cleaner
rendition:
while a1 < 5:
a1, b1 = phi([a0, a1], [b0, b1])
a1 += 1
b1 += 1
> Right, but I started my original email with "I finally found a usecase
> where *not* using assignment expression is *much* worse than using it."
"Much worse" doesn't fit with what I would write that code as, so I
must have misunderstood your code somewhere.
ChrisA
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/DAEHCXTJP4223LKLWCY4JAW6KCQXL733/
Code of Conduct: http://python.org/psf/codeofconduct/