(cls, iterable, v=None)
| 661 | |
| 662 | @classmethod |
| 663 | def fromkeys(cls, iterable, v=None): |
| 664 | # There is no equivalent method for counters because the semantics |
| 665 | # would be ambiguous in cases such as Counter.fromkeys('aaabbc', v=2). |
| 666 | # Initializing counters to zero values isn't necessary because zero |
| 667 | # is already the default value for counter lookups. Initializing |
| 668 | # to one is easily accomplished with Counter(set(iterable)). For |
| 669 | # more exotic cases, create a dictionary first using a dictionary |
| 670 | # comprehension or dict.fromkeys(). |
| 671 | raise NotImplementedError( |
| 672 | 'Counter.fromkeys() is undefined. Use Counter(iterable) instead.') |
| 673 | |
| 674 | def update(self, iterable=None, /, **kwds): |
| 675 | '''Like dict.update() but add counts instead of replacing them. |
no outgoing calls