collections.abc.MutableMapping = class MutableMapping(Mapping)
Help on class MutableMapping in collections.abc:
| Use Case | Command | Description |
|---|---|---|
| Create a mutable mapping subclass | class MyDict(MutableMapping): ... | Override __getitem__, __setitem__, __delitem__, __len__, __iter__ |
| Remove all items | d.clear() | D.clear() -> None. Remove all items from D. |
| Remove and return value for key | d.pop(key, default) | D.pop(k[,d]) -> v, remove specified key and return value. Raises KeyError if not found and no default. |
| Remove and return arbitrary item | d.popitem() | D.popitem() -> (k, v), remove and return a (key, value) pair; raises KeyError if empty. |
| Set default value for key | d.setdefault(key, default) | D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D. |
| Update with another mapping/iterable | d.update(other, **kwds) | D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. |
A MutableMapping is a generic container for associating key/value pairs.
This class provides concrete generic implementations of all methods except for __getitem__, __setitem__, __delitem__, __iter__, and __len__.
__delitem__(self, key)__setitem__(self, key, value)clear(self) — D.clear() -> None. Remove all items from D.pop(self, key, default=<object object at 0x7f8d63ba0190>) — D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.popitem(self) — D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.setdefault(self, key, default=None) — D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in Dupdate(self, other=(), /, **kwds) — D.update([E, ]**F) -> None. Update D from mapping/iterable E and F.
If E present and has a .keys() method, does: for k in E: D[k] = E[k]
If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
In either case, this is followed by: for k, v in F.items(): D[k] = v
__abstractmethods__ = frozenset({'__delitem__', '__getitem__', '__iter__', '__len__', '__setitem__'})__contains__(self, key)__eq__(self, other) — Return self==value.__getitem__(self, key)get(self, key, default=None) — D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.items(self) — D.items() -> a set-like object providing a view on D's itemskeys(self) — D.keys() -> a set-like object providing a view on D's keysvalues(self) — D.values() -> an object providing a view on D's values__hash__ = None__reversed__ = None__subclasshook__(C) from abc.ABCMeta — Abstract classes can override this to customize issubclass(). This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).__len__(self)__iter__(self)__class_getitem__ = GenericAlias(...) from abc.ABCMeta — Represent a PEP 585 generic type. E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).Generated by phpman v4.9.27-5-g2cb901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-20 01:29 @216.73.216.114
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format