Robert Kern | 6 Sep 12:14
Picon
Gravatar

Re: [Traits] dirty trait metadata

On Sat, Sep 6, 2008 at 00:33, Prabhu Ramachandran
<prabhu@...> wrote:
> Robert Kern wrote:
>
>>> Is there a simple way of doing this?  I know that I could achieve this
>>> if I implemented x as a Property(Array) but is there an easier way?
>>
>> I don't think so. The comparison logic is in C
>> (ctraits.c:setattr_trait), and there are no hooks for this.
>>
>> If you only need coarse-grained notifications, you might consider
>> using an updated Event. This:
>
> OK, so I came up with a new trait type that does this nicely with minimal
> fuss and also does the validation right.

What's the use case again? For the one you demonstrated (notification
that an array's contents have changed), I don't think the
ShadowProperty semantics are particularly the obvious way to do issue
that notification.

--

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco

Gmane