getrecursiondepth
Andrew Dalke
adalke at mindspring.com
Fri Oct 1 10:49:33 EDT 2004
Manlio Perillo wrote:
>
> Actually this can be done without using getrecursiondepth:
>
>
>>>>def foo2(n = 0):
>
> if pystate.firstlevel_call():
> foo2.recursiondepth = 0
> else:
> foo2.recursiondepth += 1
That's not thread-safe. Suppose two different threads
called foo2() at the same time. The second one ends
up resetting the recursiondepth so the first one will
get messed up.
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list