Scoping bugs in an embedded Python interpreter - Wizards please
Fredrik Lundh
fredrik at pythonware.com
Fri Sep 29 11:26:29 EDT 2006
morris.slutsky at gmail.com wrote:
> But .... I'm suffering from serious scoping bugs. I hope someone here
> can help me with them.
>
> First of all, if I type in something like;
>
> def f(x):
> if x==1:
> return x
> else:
> return x * f(x-1)
>
> and then go
> print f(5)
>
> I get an error. It says 'global name 'f' is not defined'. So
> recursion won't work because of some odd scoping bug.
looks like the globals are all messed up. it would help to see the
actual C code.
</F>
More information about the Python-list
mailing list