[/F] > -0.90000000000000002 on documenting this as "this > can be used to store static data in a function" -1 on that part from me. I never recommended to do it, I merely predicted that people *will* do it. And, they will. > +1 on the feature itself. I remain +0. [Barry] > Works for me! I think function attrs would be a lousy place to put > statics anyway. Yes, but the alternatives are also lousy: a global, or abusing default args. def f(): f.n = f.n + 1 return 42 f.n = 0 ... print "f called", f.n, "times" vs _f_n = 0 def f(): global _f_n _f_n = _f_n + 1 return 42 ... print "f called", _f_n, "times" vs def f(n=[0]): n[0] = n[0] + 1 return 42 ... print "f called ??? times" As soon as s person bumps into the first way, they're likely to adopt it, simply because it's less lousy than the others on first sight.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4