Re: Iterators and versioning



I don't understand this question... are you saying while iterating through a
collection, you have a method to modify it?.. if so, the method to modify is
given as part of the collection object, you should not use it while
iterating through the list

VJ

"kh" <kh@xxxxxxxxxxxxxxxxx> wrote in message
news:F356C32C-0A37-4E59-BA87-46665DA8B845@xxxxxxxxxxxxxxxx
I notice that using iterators it is possible to modify a collection whilst
enumerating over it's elements. Is this by design or just a side-effect of
their implementation? Viewing the disassembly for the generated classes I
note that the compiler-generated enumerator has no version checking. Is
there
an in-depth analysis of this on the www anywhere?

Thanks

kh



.



Relevant Pages

  • Re: Modify dict/set during iteration?
    ... you shouldn't modify data structures while you're ... What are you trying to accomplish by modifying objects while iterating ... As someone else pointed out, you can't use 'in' on a generator, for example. ...
    (comp.lang.python)
  • Re: Modify dict/set during iteration?
    ... you shouldn't modify data structures while you're ... guaranteed to be safe. ... What are you trying to accomplish by modifying objects while iterating ...
    (comp.lang.python)
  • Re: Modify dict/set during iteration?
    ... you shouldn't modify data structures while you're ... guaranteed to be safe. ... What are you trying to accomplish by modifying objects while iterating ...
    (comp.lang.python)
  • Re: Remove items from a list
    ... Always a bad idea to modify the structure of a list ... (deleting or inserting items) ... while iterating through it, but it's so easy ... > Dan Perl wrote: ...
    (comp.lang.python)

Quantcast