alex23 wrote:
On Jan 22, 3:27 am, MRAB <goo...@mrabarnett.plus.com> wrote:
FYI, you shouldn't modify a list you're iterating over.

But I'm not. I'm building a new list and binding it to the same name
as the original, which works perfectly fine (unless I'm missing
something):

[snip]
I was referring to the code:

    for index, record in enumerate(l):
        if record['title'] == 'ti':
            l.pop(index)

where you are enumerating and iterating over 'l', but also modifying 'l' with 'l.pop(index)'.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to