Skip to content

Commit 7b617f9

Browse files
authored
Merge pull request #432 from bjodah/define-lambdify-even-without-numpy
Add a lambdify func. that throws ModuleNotFoundError when numpy missing
2 parents 6c9a264 + fcd7cd5 commit 7b617f9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

symengine/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@
5555

5656
def lambdify(args, exprs, **kwargs):
5757
return Lambdify(args, *exprs, **kwargs)
58-
58+
else:
59+
def __getattr__(name):
60+
if name == 'lambdify':
61+
raise AttributeError("Cannot import numpy, which is required for `lambdify` to work")
62+
raise AttributeError(f"module 'symengine' has no attribute '{name}'")
5963

6064
__version__ = "0.9.2"
6165

0 commit comments

Comments
 (0)