> I was thinking more or less along the same lines, but > - you don't need the copy()
Hehehe, did you try it Kent? > - locals is a dict mapping names to values, so something like > for name, value in locals().iteritems(): > print "varname: %s type: %s" (name,type(value)) And this returns Traceback (most recent call last): File "C:\Documents and Settings\Jacob\Desktop\diction.py", line 2, in <module> print "varname: %s type: %s" (name,type(value)) TypeError: 'str' object is not callable Which is not what I expected! Until I realized that you are missing the % sign in between the print string and the tuple of values to interpolate Then it returns this: varname: __builtins__ type: <type 'module'> Traceback (most recent call last): File "C:\Documents and Settings\Jacob\Desktop\diction.py", line 1, in <module> for name, value in locals().iteritems(): RuntimeError: dictionary changed size during iteration The .copy() is necessary. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor