3 ms·
Huh? How's that a generator function?
by tome 13y ago
Huh? How's that a generator function?
- wahnfrieden 13y agoIt's not a generator, but his intention is clear - mutable keyword arguments allow for some clever tricks.
- deleted 13y ago[deleted]
- jzwinck 13y agoThey sure do--that's why we shouldn't have them. Instead: class Foo: def __init__(self): self.n = 0 def __call__(self): self.n += 1 return self.n foo = Foo()