dwavesystems / dwavesystems/dwave-optimization
Consider returning a TypeError for ``.has_state()`` for state size 0
Open
bug
enhancement
- Dominant language
- C++
- Stars
- 31
- Forks
- 36
- Avg merge
- 16h 55m
- Merged PRs (30d)
- 8
Description
Currently returns a ValueError with a technically correct but not hugely helpful error message:
```
>>> from dwave.optimization import Model
>>> model = Model()
>>> i = model.integer(3, lower_bound=0, upper_bound=20)
>>> i.has_state()
ValueError: index out of range: 0
```
Would it make sense to capture the ``model.states.size() == 0`` condition and if zero, return a TypeError with an explicit error message?
Contributor guide
Assessment
This issue has not been assessed yet.