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 += i
You can have function attribute created this way if you like:
def foo(i):
foo.bar += i
foo.bar = 5
--Jach
--
https://mail.python.org/mailman/listinfo/python-list
