MCPcopy
hub / github.com/pyodide/pyodide / setdefault

Method setdefault

src/py/_pyodide/_core_docs.py:1164–1168  ·  view source on GitHub ↗

If ``key in self``, return ``self[key]``. Otherwise sets ``self[key] = default`` and returns ``default``.

(self, key: KT, default: VT | None = None)

Source from the content-addressed store, hash-verified

1162 raise NotImplementedError
1163
1164 def setdefault(self, key: KT, default: VT | None = None) -> VT:
1165 """If ``key in self``, return ``self[key]``. Otherwise
1166 sets ``self[key] = default`` and returns ``default``.
1167 """
1168 raise NotImplementedError
1169
1170 def popitem(self) -> tuple[KT, VT]:
1171 """Remove some arbitrary ``key, value`` pair from the map and returns the

Callers 5

test_mappingsFunction · 0.80
__init__Method · 0.80
mdn_xrefs.pyFile · 0.80
add_mdn_xrefsFunction · 0.80

Calls

no outgoing calls

Tested by 2

test_mappingsFunction · 0.64