Runtime Utility Methods
types.MappingProxyType.get()
Look up a key without raising KeyError for ordinary missing dict keys; return default when missing. Delegates to the wrapped mapping.
Formal Syntax & Structure
python syntaxpython
proxy.get(key, default=None, /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| key | object | Mapping key to look up. |
| default | object | Value returned when a key is absent. |
Return Value
object
The object result described above.
Working Example
Example Snippetpython
import typesp=types.MappingProxyType({"x":2})print(p.get("x"),p.get("y",9))