Hi everyone,

I am compiling the following script using Py_CompileString


def compute(node):
        #global compute

        iter = node.getChild(0)
        while iter:
                if isinstance(iter, Group):
                        compute(iter)
                print iter
                iter = iter.next

compute(self.a0)


The I evaluate the script using PyEval_EvalCode and get a ''global name
"compute" is not
defined' error at the line of the recursive call. When I comment in the
"global" statement at the beginning of the function then everything
works fine. What's strange is the once I comment out the statement
again it still works... Somewhere something is written into a
dictionary in dunno where ?

Is it normal to have the global statement at the beginning of a
function like that ?

Cheers
Jochen

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

Reply via email to