Hi,
maybe you could do this by a decorator on the setattr method. It should
look more or less
like your implementation, but in my eyes it's a cleaner and can be reused.
Further, I would use a stack for each attribute, so that you can restore
all previous values.
bg,
Johannes
On 03/06/2013 0
On Thursday, 7 March 2013 00:07:02 UTC, Steven D'Aprano wrote:
> On Wed, 06 Mar 2013 08:56:09 -0800, Ben Sizer wrote:
>
> > I need to be able to perform complex operations on the object that may
> > modify several properties, and then gather the properties at the end as
> > an efficient way to se
Ben Sizer於 2013年3月7日星期四UTC+8上午12時56分09秒寫道:
> On Wednesday, 6 March 2013 16:22:56 UTC, Chris Angelico wrote:
>
> >
>
> > Effectively, you would need to have a
>
> > subclass of list/dict/tuple/whatever that can respond to the change.
>
>
>
> This is certainly something I'd be interested in
On Thu, Mar 7, 2013 at 3:56 AM, Ben Sizer wrote:
> On Wednesday, 6 March 2013 16:22:56 UTC, Chris Angelico wrote:
>>
>> Effectively, you would need to have a
>> subclass of list/dict/tuple/whatever that can respond to the change.
>
> This is certainly something I'd be interested in having, but I
Ben Sizer writes:
> I also believe that this won't catch modification to existing
> attributes as opposed to assignments: eg. if one of the attributes is
> a list and I append to it, this system won't notice. Is that something
> I can rectify easily?
It's really up to how far you wanna go: a sim
On Wednesday, 6 March 2013 16:22:56 UTC, Chris Angelico wrote:
>
> Effectively, you would need to have a
> subclass of list/dict/tuple/whatever that can respond to the change.
This is certainly something I'd be interested in having, but I guess that would
be fragile since the user would have t