Re: [Python-Dev] PEP 572: Assignment Expressions

2018年4月19日 22:12:13 -0700

> On Apr 19, 2018, at 4:27 PM, Christoph Groth <[email protected]> wrote:
<snip>
> def sync_runner(learner, f, static_hint):
> while True:
> points = learner.get(static_hint)
> if not points:
> break
> learner.feed(f(points))
>
>
>
> With assignment expressions the body of the above function could be
> simplified to
>
> while points := learner.get(static_hint):
> learner.feed(f(points))
>
> making it crucially simpler.
Kinda supports my assertion that what we really want is a different while loop.
Would it be ridiculous if := only worked in a while statement?
-CHB
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to