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.

classification
Title: Wanted behaviour ?
Type: behavior Stage:
Components: Versions: Python 2.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, pythonmeister
Priority: normal Keywords:

Created on 2007-12-12 10:04 by pythonmeister, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg58488 - (view) Author: Stefan Sonnenberg-Carstens (pythonmeister) Date: 2007-12-12 10:04
>>> a = {}
>>> a['a'] = [1,2,3,4,5]
>>> a['b'] = [1,2,3,4,5]
>>> a['c'] = [1,2,3,4,5]
>>> for k in a.keys():
...     print a[k]
...     for t in a[k]:
...             del a[k][a[k].index(t)]
...             print a[k]
...
[1, 2, 3, 4, 5]
[2, 3, 4, 5]
[2, 4, 5]
[2, 4]
[1, 2, 3, 4, 5]
[2, 3, 4, 5]
[2, 4, 5]
[2, 4]
[1, 2, 3, 4, 5]
[2, 3, 4, 5]
[2, 4, 5]
[2, 4]

Does this make sense ?
msg58489 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2007-12-12 10:20
This is the expected behaviour.
See the "warning" paragraph at the bottom of
http://docs.python.org/ref/for.html
History
Date User Action Args
2022-04-11 14:56:28adminsetgithub: 45944
2007-12-12 10:20:04amaury.forgeotdarcsetstatus: open -> closed
resolution: not a bug
messages: + msg58489
nosy: + amaury.forgeotdarc
2007-12-12 10:04:46pythonmeistercreate