On Tue, 1 Dec 2015 08:15 pm, Grobu wrote: > Perhaps you could use a parameter's default value to implement your > static variable? > > Like : > # ------------------------------------------------- > >>> def test(arg=[0]): > ... print arg[0] > ... arg[0] += 1 > ...
Awesome! I'm not being sarcastic, I'm serious. Thank you Grobu, for demonstrating the existence of something we debated a few days ago. In another *painfully* long thread about mutable default arguments, I suggested the same idea: using a mutable default as static storage. It is very gratifying to see that other people have independently come up with the same idea. -- Steven -- https://mail.python.org/mailman/listinfo/python-list