Check if variable is defined
mwh at python.net
Fri May 18 08:52:02 CEST 2001
Courageous <jkraska1 at san.rr.com> writes:
> >> I once wondered if vars(), locals() or globals() have a time cost to
> >> produce the dictionary in a usable format
> I'm too lazy to go over to my Python source tree at the moment,
> but I believe that these already _are_ in Python dictionaries, right
> inside Python. IOW, they aren't "producing" anything, they are
> simply giving you a reference to an already-existing construct.
And you say this following up to a post of mine that says that they do
this at module level but not inside a function? I wasn't making that
up - see eg. PyEval_GetLocals, which calls PyFrame_FastToLocals.
I love the way Microsoft follows standards. In much the same
manner that fish follow migrating caribou. -- Paul Tomblin
More information about the Python-list