[Tutor] global variables & recursion

Alan Gauld alan.gauld at blueyonder.co.uk
Mon Feb 23 17:11:13 EST 2004

> >       # function calls itself:
> >       st(b,r,_eulen+1)
> >
> >
> ## Here _rem need not be inserted as argument as it si the default
> of this fourth parameter.

While that's true I personally wouldn't advise leaving out _rem since
it makes the code more obscure and relies on a fairly arcane bit of
Python black magic. Recursive functions are notoriously hard to
anyway, and by relying on the persistent definition of a mutable
argument you make the problem even harder. All for the sake of saving
comma and 4 characters....

Alan G.

More information about the Tutor mailing list