This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients Ian, chris.jerdonek, docs@python, serhiy.storchaka
Date 2012-10-14.11:24:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1350213845.32.0.702999618177.issue16225@psf.upfronthosting.co.za>
In-reply-to
Content
It is safe to modify a sequence during iteration if it's size not increased.

>>> words = ['cat', 'window', 'defenestrate']
>>> for i, w in enumerate(words):
...     if len(w) > 6:
...         words[i] = w[:5] + '…'
... 
>>> words
['cat', 'window', 'defen…']
History
Date User Action Args
2012-10-14 11:24:05serhiy.storchakasetrecipients: + serhiy.storchaka, chris.jerdonek, docs@python, Ian
2012-10-14 11:24:05serhiy.storchakasetmessageid: <1350213845.32.0.702999618177.issue16225@psf.upfronthosting.co.za>
2012-10-14 11:24:05serhiy.storchakalinkissue16225 messages
2012-10-14 11:24:05serhiy.storchakacreate