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

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


Hi!

Example, with meta-data (attributs of function) :

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

ff(ff)
fa=ff
ff(ff)
fa(fa)
print ff.count



How to improve that?


@-salutations

Michel Claveau






More information about the Python-list mailing list