[Zope] Using getattr to access a variable defined in a Script (Python)

Dieter Maurer dieter@handshake.de
Mon, 7 Jan 2002 20:31:46 +0100


Tim Hicks writes:
 > ... inside Python script ...
 > dict = {}
 > string = 'dict'
 > print getattr(script, string)

Python defines the built in "locals" for this.
But I guess, it is not exposed to Python Scripts.

In this case, you would need to change your algorithm:

   put all your local variables in a dict or instance.


Dieter