On Wed, Dec 2, 2015 at 7:21 PM, Antoon Pardon <antoon.par...@rece.vub.ac.be> wrote: > I think python is unsuited for an obvious solution for static locals. > Because you need to initialise your static variable somewhere. If you > initialise whithin the body of your function, you will have a statement > that is essentialy a declaration instead of an executable statement. > Which goes totally against the dynamic nature op python.
It ought to be initialized at the same time the function is defined - just like argument defaults, only without them being visible as arguments. If Python had a keyword that meant "currently-executing-function", that would work out well for attributes (and might also make recursion more optimizable); otherwise, default args are probably the cleanest way we have. ChrisA -- https://mail.python.org/mailman/listinfo/python-list