We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4ffc113 commit 4a6475eCopy full SHA for 4a6475e
arraycontext/container/traversal.py
@@ -244,9 +244,16 @@ def rec(*args_: Any) -> Any:
244
except NotAnArrayContainerError:
245
return f(*args_)
246
247
- assert all(
248
- type(args_[i]) is type(template_ary) for i in container_indices[1:]
249
- ), f"expected type '{type(template_ary).__name__}'"
+ if __debug__: # noqa: SIM102
+ if not all(
+ type(args_[i]) is type(template_ary)
250
+ for i in container_indices[1:]
251
+ ):
252
+ arg_summary = ", ".join(
253
+ f"arg{i+1}: {type(arg)}"
254
+ for i, arg in enumerate(args_))
255
+ raise TypeError(
256
+ f"inconsistent types in multiple traversal: {arg_summary}")
257
258
result = []
259
new_args = list(args_)
0 commit comments