namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP
Jeremy Bowers
jerf at jerf.org
Thu Feb 10 12:14:22 EST 2005
On Thu, 10 Feb 2005 13:39:29 -0700, Steven Bethard wrote:
> Yeah, I guess that was really the motivation of this module. I
> personally wouldn't use it all that often -- certainly not with the
> frequency that I use, say, Python 2.4's set type -- but I think there
> are enough of us out here who have written essentially the same module
> enough times that it merits a little bit of standardization and addition
> to the standard library.
If it expands past what was basically a slight elaboration on
class Bunch: pass
to actually do real work, I'd be much more impressed, as long as simple
things stay simple. A hierarchy-aware get might be a good start:
>>> config = Namespace()
>>> myParm = config.get("myapp.wrapping.line", constants.STRICT)
>>> someParms = config.get("myapp.settings.printer", Namespace())
which would create the necessary namespaces or something.
More information about the Python-list
mailing list