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

2007-02-06 Thread Duncan Booth
Méta-MCI [EMAIL PROTECTED] wrote: 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? If I've

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

2007-02-05 Thread M�ta-MCI
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) @+

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

2007-02-05 Thread Bjoern Schliessmann
Méta-MCI wrote: Example, with meta-data (attributs of function) : Apart from asking what counting nb call of a function means, I wonder why you didn't use an iterator? @-salutations @-less Regards, Björn -- BOFH excuse #65: system needs to be rebooted --

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

2007-02-05 Thread M�ta-MCI
Re! why you didn't use an iterator? If the iterator is extern (to the function), it's like decorator, or global var. If it is internal, it's huge, compare to this.count=this.count+1 (or this.count+=1) @+ Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

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

2007-02-05 Thread Bjoern Schliessmann
Méta-MCI wrote: If the iterator is extern (to the function), it's like decorator, or global var. Please excuse me, I don't understand your point. I'm not even sure if both of us speak of the same iterators. If it is internal, it's huge, compare to this.count=this.count+1 (or