On 11Feb2021 20:22, duncan smith <duncan@invalid.invalid> wrote: > It seems that I can mutate a deque while iterating over it if I >assign to an index, but not if I append to it. Is this the intended >behaviour? It seems a bit inconsistent. Cheers.
I think that just means that the deque didn't _notice_ your change in the former case. Not necessarily that it wouldn't want to. I confess to not being sure that appending to a deque during an iteration should be a bad thing, except that with a bounded deque that might entail discarding the element at your current iteration point. Maybe. Cheers, Cameron Simpson <c...@cskk.id.au> -- https://mail.python.org/mailman/listinfo/python-list