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