On Sat, 24 Dec 2011 09:50:04 +1100, Chris Angelico wrote: > On Sat, Dec 24, 2011 at 9:32 AM, Steven D'Aprano > <steve+comp.lang.pyt...@pearwood.info> wrote: >> Yes. But having to manage it *by hand* is still unclean: > > Well, my point was that Python's current behaviour _is_ that.
Minus the managing it by hand part. >> * you still have to assign the default value to the function assignment >> outside the function, which is inelegant; > > C's static variables are initialized inside the function. But since > Python doesn't have that, it doesn't really work that way. (You might be > able to use a decorator to do some cool tricks though.) If Python were C, then static variables would be the right solution, but since it isn't, they aren't. -- Steven -- http://mail.python.org/mailman/listinfo/python-list