11 Sep 22:32
Re: [Traits] dirty trait metadata
David C. Morrill wrote:
> I just added support for the new 'comparison_mode' metadata, which can
> (legally) have one of the three values:
>
> - NO_COMPARE: Change fired on every assignment.
> - OBJECT_IDENTITY_COMPARE: Change fired if old value is not the same
> object as the new value.
> - RICH_COMPARE: Change fired if old value does not compare equal to
> the new value (the standard traits default).
That is excellent, thanks! It solves my particular problem.
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.
Thanks!
cheers,
prabhu
RSS Feed