Steven D'Aprano <[email protected]> writes:
> If you need instances which carry state, then object is the wrong
> class.
Right. The ‘types’ module provides a SimpleNamespace class for the
common “bag of attributes” use case::
>>> import types
>>> foo = types.SimpleNamespace()
>>> foo.x = 3
>>> foo
namespace(x=3)
<URL:https://docs.python.org/3/library/types.html#types.SimpleNamespace>
--
\ “Nothing is more sacred than the facts.” —Sam Harris, _The End |
`\ of Faith_, 2004 |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list