[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-13 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Evgeniy, please leave this closed and take the proposal to the python-ideas 
mailing list.   There is no further progress that can be made in this tracker 
issue.  We can’t discern any part of your proposal that would make sense for 
improving the language.

--
nosy: +rhettinger
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-13 Thread Evgeniy Ivanov


Evgeniy Ivanov  added the comment:

What about this?

if x > 2: my_func(x)

ok this code at 1 line, this code work, but...

PEP 8: E701 multiple statements on one line (colon)


Well f//k it with a pass
Why not add an empty action operator? What is the problem? Such an instruction 
has existed since the days of assembler - nop

--
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

If you want pass to become an expression, what should these do?

x = pass

print(pass)

mydict[pass] = 1

type(pass)

There is nothing special about the ternary if operator. It is just an 
operator like plus, minus and more. The only difference is that plus 
takes two arguments, and if...else takes three:

expression + expression

expression if expression else expression

If pass becomes legal in the if...else ternary operatory, it must be an 
expression, so it must have a value. What is that value?

--
title: 'pass' in 'if-else' linear expression -> operator 'pass' in 'if-else' 
linear expression

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


Evgeniy Ivanov  added the comment:

formaly it's not bug, this is future request ok?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


Evgeniy Ivanov  added the comment:

this wrong example

now i'm use this
x += x*2 if math.pow(x) > 386 else ''

wanted to say that doing this now

my_func(x) if x > 100 else ''

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


Evgeniy Ivanov  added the comment:

or another example:

def my_func(x):
 something_do


my_func(x) if x > 100 else 

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


Evgeniy Ivanov  added the comment:

it is more readable

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


Evgeniy Ivanov  added the comment:

ok, but what you say for this?

x += x*2 if math.pow(x) > 386 else pass

and 

if math.pow(x) > 386:
 x += x*2

1 line vs 2 line

now i'm use this

x += x*2 if math.pow(x) > 386 else ''

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


Change by Evgeniy Ivanov :


--
resolution: not a bug -> 
status: closed -> open
type: compile error -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This is not a bug, "pass" is not an operator, it is not an expression, it is a 
statement and is only allowed in places where statements are allowed.

The if expression requires all three operands to be expressions.

Even if "pass" was permitted, what would it do? What would be the value of x 
after this assignment?

x = 1 if False else pass

If you need x to be undefined, use an if statement:


if False:
# this block is not run
x = 1

# x is undefined here

--
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


New submission from Evgeniy Ivanov :

Why operator 'pass' not implement to 'if-else' linear expression?
Construction ' if  else pass' throws SyntaxError in 
Python 3.9

--
messages: 403793
nosy: evgnor86
priority: normal
severity: normal
status: open
title: operator 'pass' in 'if-else' linear expression
type: compile error
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com