3 ms·
You don't. Use dataclasses instead to get type checking. Otherwise there are tons of tricks to get what you want. To add to the list posted in sibling: a
by Too 2y ago
You don't. Use dataclasses instead to get type checking.
Otherwise there are tons of tricks to get what you want. To add to the list posted in sibling:
a = vars(a) # readonly
print(a.foo)
or
class Obj: pass;
a = Obj()
a.foo = 20