On 2019-06-23 19:49, James Lu wrote:
Apologies for the inactive post.

 > Why the double condition? The existing definition of "condition1 and
 > not condition2" already guarantees the short-circuiting, and what
 > you're effectively creating is two pieces of a single condition.
Just for clarity sir. I wanted to make clear the desired behavior. 😀

Okay, now this starts to look somewhat interesting. But what you'd be
creating here would be a feature of specific language constructs, and
probably wouldn't work everywhere.
Yes. I think it would be too hasty to add EMPTY to other language
constructs right now.

How close is this to what you were thinking of?
The conditional omission part is exactly what I'm thinking of.

I made a mistake in my original proposal. To keep all the information
organized, I'm going to keep a canonical version of the proposal on
the link below.
https://hackmd.io/CDqvdxF_QY-STrz0wQy83g

Please give it a new read. I tried to make it as clear as possible in this new version.

You wrote:

"""
if condition1 expr unless condition2

is an expression that roughly reduces to

expr if not condition1 and condition2 else EMPTY
"""

Surely it's:

"""
if condition1 expr unless condition2

is an expression that roughly reduces to

expr if condition1 and not condition2 else EMPTY
"""

Another point is that you have condition1 and expr next to each other with no separating punctuation, which looks unPythonic to me.

Under "Equivalent syntax in existing Python" you wrote:

"""
As a statement:

if condition1 and not condition2: predicate(object)

predicate(object) if condition1 and not condition2
"""

but only the first is valid as a statement.

Finally, under "For consideration: alternative syntaxes", my offering would be:

expr if condition1 and not condition2 else pass

[snip]
_______________________________________________
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/V5GURMUSFOMSRW74CHMIDIRYLYOBQNDO/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to