Namespacedifference reading - writing ??
staschuk at telusplanet.net
Fri Jun 27 15:36:01 CEST 2003
Quoth Peter Abel:
> Is there really a difference in namespacehandling depending
> on writing or reading variables?
Yes. Assigned-to variables are local; variables merely referred
to may be found in nested scopes.
"When a name is used in a code block, it is resolved using the
nearest enclosing scope. [...] If a name is bound in a block, it
is a local variable of that block. [...] If a name binding
operation occurs anywhere within a code block, all uses of the
name within the block are treated as references to the current
block. [...] The local variables of a code block can be determined
by scanning the entire text of the block for name binding
(Note that defs and whatnot are also name-binding operations.)
Steven Taschuk w_w
staschuk at telusplanet.net ,-= U
More information about the Python-list