[issue19823] for-each on list aborts earlier than expected

cost6 report at bugs.python.org
Thu Nov 28 15:03:18 CET 2013


New submission from cost6:

for-each does not iterate over all entries of collection, if one removes elements during the iteration.

Example (misbehaving) code:

def keepByValue(self, key=None, value=[]):
    for row in self.flows:
        if not row[key] in value:
            flows.remove(row)

----------
components: Interpreter Core
messages: 204653
nosy: cost6
priority: normal
severity: normal
status: open
title: for-each on list aborts earlier than expected
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19823>
_______________________________________


More information about the Python-bugs-list mailing list