[Tutor] referencing vars()

Terry Carroll carroll at tjc.com
Sun Sep 16 19:49:08 CEST 2007


On Sat, 15 Sep 2007, John wrote:

> I'm trying to do the above, but of course get an error because vardict is
> only referencing vars(), thus changes size... also, I tried
> vardict=[vars()], but this fails as well??

How about 

 import copy
 vardict=copy.copy(vars())

That way, you've made a copy of vars, and any changes that happen in the 
meantime don't matter.



More information about the Tutor mailing list