[issue27707] List reports incorrect length if modifed after yield

2016-08-08 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: when you yield, the list is empty, in this case, the length of your list is just 0 and not 1. -- nosy: +matrixise status: open -> closed ___ Python tracker __

[issue27707] List reports incorrect length if modifed after yield

2016-08-08 Thread Stéphane Wirtel
Changes by Stéphane Wirtel : -- status: closed -> open ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue27707] List reports incorrect length if modifed after yield

2016-08-08 Thread SilentGhost
SilentGhost added the comment: At the time the len function in list comprehension is called .append has not executed, the len call in list comprehension operates on object as it is, whereas the object itself is only referenced rather than copied. If you were to copy the yielded list, then a mo

[issue27707] List reports incorrect length if modifed after yield

2016-08-08 Thread Robin
New submission from Robin: reproduction script below. In the last print statement, it shows me a list with items in it, but with a length of 0 def generator(): l = [] yield l l.append(1) # this correctly prints 1 print(len(l)) # this should print [([1],