[issue21964] inconsistency in list-generator comprehension with yield(-from)

2021-12-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Resolved in issue10544. -- nosy: +serhiy.storchaka resolution: out of date -> duplicate stage: test needed -> resolved status: pending -> closed superseder: -> yield expression inside generator expression does nothing __

[issue21964] inconsistency in list-generator comprehension with yield(-from)

2021-12-10 Thread Irit Katriel
Irit Katriel added the comment: I think this issue was resolved by now. This is what happens on 3.11: >>> l = ["abc", range(3)] >>> g = [(yield from i) for i in l] File "", line 1 SyntaxError: 'yield' inside list comprehension >>> g2 = ((yield from i) for i in l) File "", line 1 SyntaxErr

[issue21964] inconsistency in list-generator comprehension with yield(-from)

2014-07-21 Thread STINNER Victor
STINNER Victor added the comment: > For `g1`: it returns a generator because the listcomp contains a `yield from`. IMO it's a bug: [... for ... in ...] must create a list. -- ___ Python tracker ___

[issue21964] inconsistency in list-generator comprehension with yield(-from)

2014-07-21 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

[issue21964] inconsistency in list-generator comprehension with yield(-from)

2014-07-19 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- versions: -Python 3.2, Python 3.3 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe

[issue21964] inconsistency in list-generator comprehension with yield(-from)

2014-07-19 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- stage: -> test needed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue21964] inconsistency in list-generator comprehension with yield(-from)

2014-07-14 Thread hakril
hakril added the comment: I found something else, I think it worth mentioning it. This side-effect allows to create generators that return other values that None. And the CPython's behavior is not the same for all versions: >>> {(yield i) : i for i in range(2)} at 0x7f0b98f41410>

[issue21964] inconsistency in list-generator comprehension with yield(-from)

2014-07-12 Thread Nick Coghlan
Nick Coghlan added the comment: It's a side effect of the hidden closure that provides the new scope for the iteration variable - that's an ordinary function object, so using yield or yield from turns it into a generator expression instead. Generator expressions are already generators, so usin

[issue21964] inconsistency in list-generator comprehension with yield(-from)

2014-07-12 Thread Ezio Melotti
Ezio Melotti added the comment: There seem to be two issues here: > list comprehension with yield(-from) would return a generator. This is somewhat surprising, and I'm not sure it's expected/documented. The example you provided seems to behave reasonably, so I don't think we should change the

[issue21964] inconsistency in list-generator comprehension with yield(-from)

2014-07-11 Thread hakril
New submission from hakril: Will playing with generators and `yield from` I found some inconsistency. list comprehension with yield(-from) would return a generator. generator comprehension would yield some None in the middle of the expected values. Examples: l = ["abc", range(3)] g1 =