-
Notifications
You must be signed in to change notification settings - Fork 67
Make Basic.has behave more like SymPy, use new visitor #521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
symengine/__init__.py
Outdated
@@ -19,7 +19,7 @@ | |||
Max, Min, DenseMatrix, Matrix, | |||
ImmutableMatrix, ImmutableDenseMatrix, MutableDenseMatrix, | |||
MatrixBase, Basic, DictBasic, symarray, series, diff, zeros, | |||
eye, diag, ones, Derivative, Subs, expand, has_symbol, | |||
eye, diag, ones, Derivative, Subs, expand, has_basic, has_symbol, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not export has_basic
and use .has
def has(self, *symbols): | ||
return any([has_symbol(self, symbol) for symbol in symbols]) | ||
def has(self, *args): | ||
for arg in args: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The loop here begs the question:
Should HasBasicVisitor
's looking_for_
rather be a vec_basic
instead of a simple rcp_basic? If it's common to query with multiple arguments, then a vec_basic would avoid traversing the (possibly large) syntax tree multiple times, but if the majority of use cases only matches against a single argument, that would be a pessimisation, what do you think?
ready for review. |
thanks! |
This supersedes gh-515
This would require: