Well... You could add "global foo" before the "def foo...", but I
suppose it would defeat the purpose of making foo a local function.
Alternatively, you could define and instantiate a local class with a
recursive method foo(). But by the time you're doing that, you may be
better off structuring your whole program as a class instead of as a
module with functions...
The moral of this story? You can trade globals for classes. Or
perhaps: don't try to write Pascal in Python ;-)
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>