Message311700
Some other points to consider: I don't think this belongs in the `for` statement docs at all. Instead they should merely _note_ that what happens if a sequence being iterated over is mutated is up to the sequence iterator.
Then, e.g., the `list` docs should spell out the behavior currently (but, as already noted, incompletely) described. From StackOverflow experience, I may be the only person in the world who knows that list behavior here is documented under the `for` statement - everyone else gives up after not finding a word about it in the `list` docs ;-)
`collections.deque` docs, in contrast, may wish to document the behavior of its iterators. They in fact work hard to raise an exception if a size-changing mutation occurs during iteration, but that doesn't appear to be documented. It's worth debating whether it should be.
Are there other mutable sequence types in the standard distribution? |
|
Date |
User |
Action |
Args |
2018-02-06 02:08:01 | tim.peters | set | recipients:
+ tim.peters, rhettinger, docs@python |
2018-02-06 02:08:01 | tim.peters | set | messageid: <1517882881.56.0.467229070634.issue32767@psf.upfronthosting.co.za> |
2018-02-06 02:08:01 | tim.peters | link | issue32767 messages |
2018-02-06 02:08:00 | tim.peters | create | |
|