Runtime Utility Classes

types.SimpleNamespace()

Construct a mutable attribute namespace with a readable representation and equality based on namespace dictionaries. Python 3.13 accepts an optional mapping or iterable of pairs before keyword attributes.

Formal Syntax & Structure

python syntaxpython
types.SimpleNamespace(obj=(), /, **kwargs)

Parameters & Attributes

NameTypeDescription
objmapping or iterableOptional initial mapping or iterable of name-value pairs with string keys.
kwargsobjectNamed attributes, overriding matching initial keys.

Return Value

SimpleNamespace

The SimpleNamespace result described above.

Working Example

Example Snippetpython
import typesn=types.SimpleNamespace({"count":2}, name="Ada")n.count+=1print(n.name, n.count)
Python Reference