On 28/04/2020 06:49, jf...@ms4.hinet.net wrote:
And as you have shown - foo.bar is effectively a global variable - just one with a qualified name :-)bvdp於 2020年4月28日星期二 UTC+8上午9時46分35秒寫道:Oh my, that is very cool! So, I can do this:def foo(i): if not 'bar' in foo.__dict__: foo.bar = 5 foo.bar += iYou can have function attribute created this way if you like: def foo(i): foo.bar += i foo.bar = 5 --Jach
-- Tony Flury -- https://mail.python.org/mailman/listinfo/python-list