Ramil Nugmanov added the comment:
Yes,
[x for x in [1, 2, 3] if 1 if 1]
can be replaced with:
for x in [1, 2, 3]:
if 1:
if 1:
yield x
However this syntax is strange and leads to errors like:
[x for x in [1, 2, 3] if x is not None] >> [x for x in [1, 2, 3] i
New submission from Ramil Nugmanov :
treat without error two if in generators.
>>>[x for x in [1, 2, 3] if 1 if 1]
[1, 2, 3]
>>>[x for x in [1, 2, 3] if 0 if 1]
[]
expected syntax error
--
components: Parser
messages: 412726
nosy: lys.nikolaou, pablogsal, stsouk
Change by Ramil Nugmanov :
--
keywords: +patch
pull_requests: +19741
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/20492
___
Python tracker
<https://bugs.python.org/issu
New submission from Ramil Nugmanov :
def x(y):
while True:
yield y
p = product(x(1), x(2))
next(p) # this string will never be reached.
--
components: Library (Lib)
messages: 370201
nosy: nougmanoff
priority: normal
severity: normal
status: open
title: itertools.product