is this pythonic?
google at mrabarnett.plus.com
Wed Jan 21 18:56:59 CET 2009
> On Jan 22, 3:27 am, MRAB <goo... at 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
I was referring to the code:
for index, record in enumerate(l):
if record['title'] == 'ti':
where you are enumerating and iterating over 'l', but also modifying 'l'
More information about the Python-list