Terry Reedy wrote:
"Charles Krug" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Both of these techniques look promising here.
Here a third, the closure approach (obviously not directly tested):
Just for grins, here's a fourth approach, using the descriptor protocol
>>> def func_with_state(state,a):
... state.append(a)
... return state
...
>>> f = func_with_state.__get__([])
>>> f(1)
[1]
>>> f(2)
[1, 2]
>>> f(3)
[1, 2, 3]
>>>
Michael
--
http://mail.python.org/mailman/listinfo/python-list