enthought / enthought/traits

`Expression` trait doesn't store default mapped value correctly

Open
#1,646 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
462
Forks
90
PR merge metrics
No merged PRs in 30d

Description

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]: at 0x7ffb01cbec90, file "", 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.