Michael Casaday writes:
Defining functions within Script (Python) methods doesn't seem to work very well. This code...
def funcA(): print "<p>Hello, from funcA()!</p>"
def funcB(): print "<p>Hello, from funcB()! I also have a message from funcA()...</p>" funcA()
funcB() return printed
....produces the following error...
Error Type: Name ErrorError Value: funcA In Python2.1/Zope 2.4, it will work.
In older Python versions, you have only 2 scopes: function local and module global. The body of a Python script is a Python function body. You are in the function local scope. Inside a local function definition, you see only it own local definitions and the global module ones but not the local definitions in the enclosing scope. This will change with Python 2.1 nested scope support. Dieter