David C. Morrill | 12 Sep 00:52

Re: [Traits] dirty trait metadata

Prabhu Ramachandran wrote:
> However, the question about notification on properties remains.  If I 
> were to define something like this:
>
> class Data(HasTraits):
>     x = Property(Float)
>
>     def _set_x(self, val):
>         old = self._x
>         self._x = val
>         self.trait_property_changed('x', old, val)
>
> d = Data()
>
> Then even if someone did d.set(x=1, trait_change_notify=False), you'd 
> get a notification that x changed, right?  My patch "fixed" that perhaps 
> incorrectly but the solution was clean and solved the above issue.  I'd 
> like to know your thoughts on this.
>
>   

Yes, I have not forgotten this, although it would serve you better if 
you wrote up a ticket (and attached your patch to that as well). I know 
you have trouble creating tickets, but it does make it more trackable. 
If you do, please put it in the Traits 3.0.3 milestone, since the 3.0.2 
milestone is pretty much in the bag.

I understand what you want to do, and I believe the core of your 
solution is valid. The only problem I have is folding it into the 
solution we already have (and which your example is not using).

I spent some time thinking about it yesterday, and there are no major 
hurdles to implementing a solution other than keeping the (C) code 
fairly clean and simple.  I also need to refactor our current solution a 
little more, to further simplify how it would be used. When it's all 
done, your example above will just be a one liner.

I've been busy this week trying to clean up the last few bugs in the 
Traits 3.0.2 release, but I'll try to work on this next week. In the 
meantime, please submit the ticket :-)

Dave Morrill

Gmane