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
>>> 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
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
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
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
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(
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