On Oct 18, 3:52 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 18 Oct 2007 15:24:27 +1000, Ben Finney wrote: > > Steven D'Aprano <[EMAIL PROTECTED]> writes: > > >> and help(reversed) but neither gives any insight to what happens when > >> you use reversed() on a sequence, then modify the sequence. > > > I would think the answer is the same for any question about modifying > > sequences while iterating: "undefined, therefore don't do that". > > That's not correct. You can modify sequences while iterating, and the > results are often perfectly predictable (but watch out for off-by-one > errors):
Perhaps a better word to use here would have been "undocumented", and therefore unsafe to use, as it might differ in different versions, or in different data-types. Dictionaries cannot continue iteration once they have changed size. -- http://mail.python.org/mailman/listinfo/python-list