On Dec 23, 2015 7:00 AM, "Chris Angelico" wrote:
> On Wed, Dec 23, 2015 at 11:46 PM, Neal Becker wrote:
> > Sometimes I want to collect attributes on an object. Usually I would make
> > an empty class for this. But it seems unnecessarily verbose to do this. So
> > I thought, why not just use a
On Wed, Dec 23, 2015 at 11:46 PM, Neal Becker wrote:
> I'm a bit surprised that an object() can't have attributes:
>
> In [30]: o = object()
>
> In [31]: o.x = 2
> ---
> AttributeError
On Thu, Dec 24, 2015 at 2:49 AM, Irmen de Jong wrote:
> Hey, nice, didn't know about SimpleNamespace. I was about to suggest
> collections.namedtuple but that one is probably more than Neal asked for.
>
> Alternatively, you can still put attributes on a function, so this works as
> well (but I
>
On 23-12-2015 13:58, Chris Angelico wrote:
> On Wed, Dec 23, 2015 at 11:46 PM, Neal Becker wrote:
>> Sometimes I want to collect attributes on an object. Usually I would make
>> an empty class for this. But it seems unnecessarily verbose to do this. So
>> I thought, why not just use an Object?
On Wed, Dec 23, 2015 at 11:46 PM, Neal Becker wrote:
> Sometimes I want to collect attributes on an object. Usually I would make
> an empty class for this. But it seems unnecessarily verbose to do this. So
> I thought, why not just use an Object? But no, an instance of Object
> apparantly can'
I'm a bit surprised that an object() can't have attributes:
In [30]: o = object()
In [31]: o.x = 2
---
AttributeErrorTraceback (most recent call last)
in ()
> 1 o.x = 2
A