Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95256
| References | <CAPTjJmoLSZjoerPeJ5a+Nh1ftcQfqgdcF-xB=3Xn7m2WKxyjHA@mail.gmail.com> <20150811042807.GA56342@cskk.homeip.net> |
|---|---|
| Date | 2015-08-11 08:06 -0400 |
| Subject | Re: looking for standard/builtin dict-like data object |
| From | Vladimir Ignatov <kmisoft@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.78.1439294768.3627.python-list@python.org> (permalink) |
>>> I also thought the stdlib had some kind of "namespace" class with this >>> kind >>> of API, but I can't find it now:-( >> >> >> It does - types.SimpleNamespace(). It accepts keyword arguments, and >> will let you create more attributes on the fly (unlike a namedtuple). > > > Yes, that's it. Thanks! > Ah, sad, sad, sad. We unfortunately stuck with built-in Python 2.6.x in our system. I see from docs that SimpleNamespace is rather new creation (3.3+). I know 'namedtuple' way, but don't like it as I prefer freedom in attribute creation/mutation. Looks like I have to stuck with handmade solution for now. Anyway - thanks a lot for everybody! Vladimir https://itunes.apple.com/us/app/python-code-samples/id1025613117
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: looking for standard/builtin dict-like data object Vladimir Ignatov <kmisoft@gmail.com> - 2015-08-11 08:06 -0400
csiph-web