Skip to content

Commit

Permalink
minor: use isinstance to check type
Browse files Browse the repository at this point in the history
  • Loading branch information
mrava87 committed Jul 26, 2024
1 parent ab5b43f commit 33c5da5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pylops/linearoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,9 @@ def __init__(
raise ValueError("LinearOperator expected as A")
if not np.isscalar(alpha):
raise ValueError("scalar expected as alpha")
if type(alpha) is complex and not np.iscomplexobj(np.ones(1, dtype=A.dtype)):
if isinstance(alpha, complex) and not np.iscomplexobj(
np.ones(1, dtype=A.dtype)
):
# if the scalar is of complex type but not the operator, find out type
dtype = _get_dtype([A], [type(alpha)])
else:
Expand Down

0 comments on commit 33c5da5

Please sign in to comment.