Commit 55d3172
authored
Add numbers.Number to COEFFICIENT_TYPES in SymbolicOperator (#1171)
numpy.int64 and other numeric types are currently not accepted as
coefficients (assuming this is not on purpose). Instead of adding them
manually, numbers. Number evaluates to true for all of them.
In principle int, float, complex could be removed (left them for
clarity)
This prevents errors like
```python
def __init__(self, term=None, coefficient=1.0):
if not isinstance(coefficient, COEFFICIENT_TYPES):
> raise ValueError('Coefficient must be a numeric type. Got {}'.format(type(coefficient)))
E ValueError: Coefficient must be a numeric type. Got <class 'numpy.int64'>
```1 parent 5b92653 commit 55d3172
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
0 commit comments