[Python-3000] Iterators for dict keys, values, and items == annoying :)
adam.deprince at gmail.com
Sun Mar 26 01:59:00 CET 2006
I've made some updates to the Mutable iterators PEP.
For the implementation I'm going to just implement the deleting iter for
list and dict.
I don't want iter implementors to scurry over their code just to add
"nop exception throwers" as delete methods, so I'm calling for the
absence of a .delete method to indicate that deleting is not supported.
If it quacks ...
Also, there is the issue of modification while iterating. Lists don't
care at all and dictionaries only care so long as you don't change the
I propose that we adopt for the new deleting iterators Java's fast fail
semantics. Basically, if the underlying data-store is touched in a way
that doesn't make sense (i.e. we touch the dict and it rehashes), we
actively tell any still alive iters (weak references are nice for this)
As for what qualifies as a compatible or incompatible change will depend
on the iterator and backing store implementation of course ... how
specific or demanding should we be?
On Fri, 2006-03-24 at 23:38 -0800, Guido van Rossum wrote:
> On 3/24/06, Adam DePrince <adam.deprince at gmail.com> wrote:
> > > Maybe. I need a volunteer to write the PEP!
> > Oh, why not. Me me!
> Excellent! Let us know when it's ready or when you'r stuck.
> --Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000