Count nb call of a function, without global var or decorator

Méta-MCI enleverlesX.XmcX at XmclaveauX.com
Mon Feb 5 11:33:42 EST 2007


Re!

I can do :

def ff():
    this=ff
    try:
        this.count=this.count+1
    except:
        this.count=1
    a=1
    b=2
    c=a+b

ff()
fa=ff
ff()
fa()

print ff.count


But that use, inside the function, the litteral name of the function; and I 
want no use litteral name (inside)

@+

Michel Claveau







More information about the Python-list mailing list