[issue27707] List reports incorrect length if modifed after yield
SilentGhost
report at bugs.python.org
Mon Aug 8 05:05:26 EDT 2016
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 more expected behaviour of returning [([], 0)] would be demonstrated.
----------
nosy: +SilentGhost
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27707>
_______________________________________
More information about the Python-bugs-list
mailing list