[Python-ideas] Modern language design survey for "assign and compare" statements
Daniel Moisset
dmoisset at machinalis.com
Mon May 21 07:29:36 EDT 2018
On 21 May 2018 at 12:05, Rhodri James <rhodri at kynesim.co.uk> wrote:
>
> Thanks for the analysis, but I'm afraid I must disagree with your
> recommendation. It was the thought I first had when Chris came out with
> his first draft of the PEP several months ago, but it's not enough to cope
> with my usual use cases. What I normally want is the Python equivalent of:
>
> while ((v = get_something()) != INCONVENIENT_SENTINEL)
> do_something(v);
>
> The condition expression itself is not what I want to capture; I need a
> subexpression, which the "as" syntax won't give me.
>
>
That use case should be covered by
for v in iter(get_something, INCOVENIENT_SENTINEL):
do_something(v)
--
<https://www.machinalis.co.uk>
Daniel Moisset
UK COUNTRY MANAGER
A: 1 Fore Street, EC2Y 9DT London <https://goo.gl/maps/pH9BBLgE8dG2>
P: +44 7398 827139 <+44+7398+827139>
M: dmoisset at machinalis.com <dmoisset at machinalis.com> | S: dmoisset
<http://www.linkedin.com/company/456525>
<http://www.twitter.com/machinalis> <http://www.facebook.com/machinalis>
<https://www.instagram.com/machinalis.life/>
Machinalis Limited is a company registered in England and Wales. Registered
number: 10574987.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180521/b65b57fc/attachment.html>
More information about the Python-ideas
mailing list