traits
traits copied to clipboard
`Expression` trait doesn't store default mapped value correctly
For example, see how the default value for e_
is a string, but is a code object for a non-default value.
In [1]: from traits.api import Expression, HasTraits
In [2]: class Test(HasTraits):
...: e = Expression("3")
...:
In [3]: t = Test()
In [4]: t.e
Out[4]: '3'
In [5]: t.e_
Out[5]: '3'
In [6]: t.e = '4'
In [7]: t.e
Out[7]: '4'
In [8]: t.e_
Out[8]: <code object <module> at 0x7ffb01cbec90, file "<string>", line 1>
Other mapped traits like Map
seem to do things right.
This is related to #1114 and would be likely fixed by the suggestion there.