Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95256 > unrolled thread

Re: looking for standard/builtin dict-like data object

Started byVladimir Ignatov <kmisoft@gmail.com>
First post2015-08-11 08:06 -0400
Last post2015-08-11 08:06 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: looking for standard/builtin dict-like data object Vladimir Ignatov <kmisoft@gmail.com> - 2015-08-11 08:06 -0400

#95256 — Re: looking for standard/builtin dict-like data object

FromVladimir Ignatov <kmisoft@gmail.com>
Date2015-08-11 08:06 -0400
SubjectRe: looking for standard/builtin dict-like data object
Message-ID<mailman.78.1439294768.3627.python-list@python.org>
>>> 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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web