RuntimeError: dictionary changed size during iteration

Terry Reedy tjreedy at udel.edu
Mon Dec 8 19:26:37 EST 2008


Robert Dailey wrote:

> stuff = vars()

 >>> vars() is globals()
True

> for key in stuff:

You just changed globals, which is aliased as stuff.
Stuff changes.

>     print( key, '--', stuff[key] )
> 
> 
> 
> I get the following error message:
> ('CopyEmotionFX', '--', <function CopyEmotionFX at 0x0205BF70>)
> Traceback (most recent call last):
>   File "C:\IT\work\jewett\depends.py", line 12, in <module>
>     for key in stuff:
> RuntimeError: dictionary changed size during iteration
> 
> Why is this happening?




More information about the Python-list mailing list