python said : "1, 2, 3, 6, 7, manbo !"

Francis Avila francisgavila at yahoo.com
Thu Jan 22 00:47:10 EST 2004


Erik Max Francis wrote in message <400F3D90.2176087B at alcyone.com>...
>- 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.
>

Try this instead:

a = [i for i in range(8) if not i == 4]
-- 
Francis Avila



More information about the Python-list mailing list