Skip to content

Commit 877b89d

Browse files
alexfiklinducer
andauthored
Disable __bool__ on DOFArray (#251)
* disable __bool__ on DOFarray * clarify message on __bool__ error Co-authored-by: Andreas Klöckner <[email protected]> Co-authored-by: Andreas Klöckner <[email protected]>
1 parent 161bc7c commit 877b89d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

meshmode/dof_array.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ def __repr__(self):
173173

174174
# {{{ sequence protocol
175175

176+
def __bool__(self):
177+
raise ValueError(
178+
"The truth value of a DOFArray is not well-defined. "
179+
"Use actx.np.any(x) or actx.np.all(x)")
180+
176181
def __len__(self):
177182
return len(self._data)
178183

0 commit comments

Comments
 (0)