On 28 Mar 2005 23:01:34 -0800, "Dan Bishop" <[EMAIL PROTECTED]> wrote:
>>>> def print_vars(vars_dict=None): >... if vars_dict is None: >... vars_dict = globals() >... for var, value in vars_dict.items(): >... print '%s = %r' % (var, value) >... >>>> myPlace = 'right here' >>>> myTime = 'right now' >>>> print_vars() >print_vars = <function print_vars at 0x401e0d84> >__builtins__ = <module '__builtin__' (built-in)> >myTime = 'right now' >myPlace = 'right here' >__name__ = '__main__' >__doc__ = None Fred = 5 John = 8 Winner = John Both John and Winner are pointing to the literal '8'. Mixing data and program code, ie.. variable names as data, is not a good idea. Dictionaries are one of pythons best features. ;) Ron -- http://mail.python.org/mailman/listinfo/python-list