python said : "1, 2, 3, 6, 7, manbo !"
Edward C. Jones
edcjones at erols.com
Thu Jan 22 09:56:04 EST 2004
- Previous message (by thread): python said : "1, 2, 3, 6, 7, manbo !"
- Next message (by thread): python said : "1, 2, 3, 6, 7, manbo !"
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Erik Max Francis wrote:
> - wrote:
>
>
>>Why 5 does not appear ? (this was the source of a deep bug in a 4000+
>>lines networked program...)
>
>
> You are iterating over a mutable sequence while you are mutating it.
> That is a big no-no.
This can sometimes be done safely by iterating backwards:
n = len(seq)
for i in range(n-1, -1, -1):
...
- Previous message (by thread): python said : "1, 2, 3, 6, 7, manbo !"
- Next message (by thread): python said : "1, 2, 3, 6, 7, manbo !"
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-list
mailing list