Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expression trait doesn't store default mapped value correctly #1646

Open
corranwebster opened this issue May 20, 2022 · 0 comments
Open

Expression trait doesn't store default mapped value correctly #1646

corranwebster opened this issue May 20, 2022 · 0 comments

Comments

@corranwebster
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant