[issue46674] Two if in a row in generators

2022-02-07 Thread Ramil Nugmanov


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] if x if not 
None]

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

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



[issue46674] Two if in a row in generators

2022-02-07 Thread Ramil Nugmanov


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, stsouko
priority: normal
severity: normal
status: open
title: Two if in a row in generators
type: behavior
versions: Python 3.8

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



[issue40806] itertools.product not lazy

2020-05-28 Thread Ramil Nugmanov


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/issue40806>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40806] itertools.product not lazy

2020-05-28 Thread Ramil Nugmanov


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 not lazy
type: behavior
versions: Python 3.8

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