stef mientki wrote:
> I want to view my own namespace,
> i.e. to see the modules namespace in the module itself,
> is that possible ?
> 
> I can use
>    dir()
> but I read dir is just a convenience function,
> and besides I want key/value pairs.

vars() will give you a dictionary copy of the local namespace, but modifying it
won't modify the namespace.

globals() will give you the module's namespace as a dictionary which you can 
modify.

locals() will give you the local namespace (wherever you happen to be), but you
may be restricted from modifying that dictionary in some circumstances.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to