79721484

Date: 2025-07-31 15:03:17
Score: 1.5
Natty:
Report link

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

Python Feature Availability Matrix

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Joran