MCPcopy Index your code
hub / github.com/python/cpython / fromkeys

Method fromkeys

Lib/collections/__init__.py:663–672  ·  view source on GitHub ↗
(cls, iterable, v=None)

Source from the content-addressed store, hash-verified

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.

Callers 15

_deduplicateFunction · 0.45
__init__Method · 0.45
IEEEContextFunction · 0.45
__init__Method · 0.45
TextWrapperClass · 0.45
MorselClass · 0.45
fromkeysMethod · 0.45
setUpMethod · 0.45
test_meth_class_getMethod · 0.45
setUpMethod · 0.45
setUpMethod · 0.45

Calls

no outgoing calls

Tested by 15

setUpMethod · 0.36
test_meth_class_getMethod · 0.36
setUpMethod · 0.36
setUpMethod · 0.36
setUpMethod · 0.36
test_class_methodsMethod · 0.36
test_dictMethod · 0.36
test_basic_line_wrapMethod · 0.36
test_sort_dictMethod · 0.36
__init__Method · 0.36