Partially dynamic Range traits not recognised as dynamic.
- Dominant language
- Python
- Stars
- 462
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
Some part-dynamic Range traits don't work correctly. The following definition raises a `ValueError` at class-creation time:
```
>>> class A(HasTraits):
... low = Int(0)
... value = Int(3)
... r = Range(value='value', low='low', high=10.0)
...
Traceback (most recent call last):
File "", line 1, in
File "", line 4, in A
File "/Users/mdickinson/.edm/envs/resist/lib/python2.7/site-packages/traits/trait_types.py", line 1693, in __init__
low = float( low )
ValueError: could not convert string to float: low
```
The example works if `10.0` is replaced with `10`, and also works if the roles of `low` and `high` are reversed. The cause is that the value-type inference code [here](https://github.com/enthought/traits/blob/a99b3f64d50c5f7f28ffc01bf69419b061f9e976/traits/trait_types.py#L1677-L1680) is doing the wrong thing in the case where `high` is a float and `low` is a string.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.