3 ms·
Oh, this is nice. You can do it in one line (plus imports) with d = defaultdict(count().__next__)
by klyrs 6y ago
Oh, this is nice. You can do it in one line (plus imports) with
d = defaultdict(count().__next__)
- scienceman 6y agoInteresting... I wonder if this is vulnerable to getting garbaged collected at any point during execution.
- klyrs 6y agoNo, the __next__ slot wrapper holds a reference to its associated count object.