[Python-Dev] Weak dict iterators are fragile (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Sun Oct 11 18:26:21 CEST 2009


Antoine Pitrou <solipsis pitrou.net> writes:

1. Add the safe methods listkeys(), listitems(), listvalues() which would behave as the keys(), etc. methods from 2.x 2. Make it so that keys(), items(), values() atomically build a list of items internally, which makes them more costly for large weak dicts, but robust.

And a third one (a bit more complicated implementation-wise):

  1. Delay weak dict removals until any iteration has finished.

Regards

Antoine.



More information about the Python-Dev mailing list