MCPcopy Create free account
hub / github.com/grantjenks/python-sortedcontainers / fromkeys

Method fromkeys

sortedcontainers/sorteddict.py:338–349  ·  view source on GitHub ↗

Return a new sorted dict initailized from `iterable` and `value`. Items in the sorted dict have keys from `iterable` and values equal to `value`. Runtime complexity: `O(n*log(n))` :return: new sorted dict

(cls, iterable, value=None)

Source from the content-addressed store, hash-verified

336
337 @classmethod
338 def fromkeys(cls, iterable, value=None):
339 """Return a new sorted dict initailized from `iterable` and `value`.
340
341 Items in the sorted dict have keys from `iterable` and values equal to
342 `value`.
343
344 Runtime complexity: `O(n*log(n))`
345
346 :return: new sorted dict
347
348 """
349 return cls((key, value) for key in iterable)
350
351
352 def keys(self):

Callers 2

test_initFunction · 0.80
test_fromkeysFunction · 0.80

Calls

no outgoing calls

Tested by 2

test_initFunction · 0.64
test_fromkeysFunction · 0.64