[Python-ideas] Modern language design survey for "assign and compare" statements

Chris Angelico rosuav at gmail.com
Sat May 19 19:00:40 EDT 2018

On Sun, May 20, 2018 at 8:56 AM, Mike Miller <python-ideas at mgmiller.net> wrote:
> On 2018-05-18 19:14, Chris Angelico wrote:
>> Yes, largely because it's insufficient for all but a small handful of
>> situations. I mentioned that in the previous email.
> I'd argue that they are the bulk of occurrences, that's why they've been
> chosen as the compromise in those languages.
> Once there is an assignment and two compares, the time to break up the
> statement is approaching quickly, no?

But you can't put a comparison after the assignment, if it's part of
the syntax of the 'if' statement. That's not how grammar works. So you
have two options: either the ONLY thing you can capture is the
condition value (which you already know to be truthy), or it's part of
a more general expression, and is independent of if/while. You said
yourself that the first one isn't enough. So it HAS to be an
expression feature, not a statement feature.


More information about the Python-ideas mailing list