
May 3, 2007
5 a.m.
On 5/2/07, Joel Bender <jjb5@cornell.edu> wrote:
@local(history = []) def foo(x): foo.history.append(x)
This assumes that the name "foo" won't be rebound underneath you. That is usually, but not always, true. __this_function__ from PEP 3130 would solve that gotcha.
I like this because it keeps history out of the parameter list, and while it's not part of the local namespace, it's readily accessible.
Those are good things. -jJ