Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

See the grammar. 
https://docs.python.org/3/reference/expressions.html#conditional-expressions


conditional_expression ::=  or_test ["if" or_test "else" expression]
expression             ::=  conditional_expression | lambda_expr

`*()` is not an expression. It is either a starred_item (which can be a part of 
starred_list or a starred_expression), or a positional_item or a 
starred_and_keywords which are parts of an argument_list. None of them are 
expressions.

`foo(*(stri,) if stri else x)` is interpreted as `foo(*((stri,) if stri else 
x))` if x is an expression. But `*()` is not an expression, thus a syntax error.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46865>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to