how to explain such codes, python's bug or mine?
Fredrik Lundh
fredrik at pythonware.com
Wed Apr 13 08:11:12 EDT 2005
"MaHahaXixi" <enjoy_linux at hotmail.com> wrote:
> for python, i am a newbie, but i did not found the warning of such usage
> from the python tutorial
"4.2 for Statements"
"It is not safe to modify the sequence being iterated over in the loop (this
can only happen for mutable sequence types, such as lists). If you need
to modify the list you are iterating over (for example, to duplicate selected
items) you must iterate over a copy." (followed by an example)
</F>
More information about the Python-list
mailing list