Python's equivalent to PHP's stdClass
is SimpleNamespace
from the types
module
from types import SimpleNamespace
# Create empty object
obj = SimpleNamespace()
obj.name = "John"
obj.age = 30
# Or initialize with data
person = SimpleNamespace(name="John", age=30)
person.city = "Amsterdam" # Add attributes dynamically