4 ms·
Side note: You can use python classes for that. It's a common pattern for me to have something like this in my projects class Holder: pass Simply
by shezi 6y ago
Side note: You can use python classes for that. It's a common pattern for me to have something like this in my projects
class Holder:
pass
Simply add any attributes at runtime. It's essentially a different interface for the built-in dict of the instances.
Add a bit of getattr magic and you can read undefined attributes, too.