MCPcopy Index your code
hub / github.com/RustPython/RustPython / fromkeys

Method fromkeys

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

Source from the content-addressed store, hash-verified

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.

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_sort_dictMethod · 0.36
test_allMethod · 0.36
test_fromkeysMethod · 0.36