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

2015-08-11 Thread Chris Angelico
On Tue, Aug 11, 2015 at 10:06 PM, Vladimir Ignatov wrote: 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 attr

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

2015-08-11 Thread Vladimir Ignatov
>>> 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. Tha

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

2015-08-10 Thread Cameron Simpson
On 11Aug2015 14:09, Chris Angelico wrote: On Tue, Aug 11, 2015 at 1:40 PM, Cameron Simpson wrote: 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 c

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

2015-08-10 Thread Chris Angelico
On Tue, Aug 11, 2015 at 1:40 PM, Cameron Simpson wrote: > 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

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

2015-08-10 Thread Cameron Simpson
On 10Aug2015 23:22, Vladimir Ignatov wrote: In my code I often use my own home-brewed object for passing bunch of data between functions. Something like: class Data(object): def __init__ (self, **kwargs): self.__dict__ = kwargs return Data(attr1=..., attr2=..., attr3=...) Logic

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

2015-08-10 Thread Chris Rebert
On Mon, Aug 10, 2015 at 8:22 PM, Vladimir Ignatov wrote: > Hi, > > In my code I often use my own home-brewed object for passing bunch of > data between functions. Something like: > > class Data(object): > def __init__ (self, **kwargs): > self.__dict__ = kwargs > > > > return Data(

looking for standard/builtin dict-like data object

2015-08-10 Thread Vladimir Ignatov
Hi, In my code I often use my own home-brewed object for passing bunch of data between functions. Something like: class Data(object): def __init__ (self, **kwargs): self.__dict__ = kwargs return Data(attr1=..., attr2=..., attr3=...) Logically it works like plain dictionary bu