-
Notifications
You must be signed in to change notification settings - Fork 173
Open
Labels
Description
Currently in SymPy (as well as symengine.py) you can use both (x**2).is_Pow and isinstance(x**2, sym.Pow):
In [1]: import sympy as sym
In [3]: sym.var("x")
Out[3]: x
In [4]: (x**2).is_Pow
Out[4]: True
In [5]: isinstance(x**2, sym.Pow)
Out[5]: True
But you can only use isinstance(sym.log(x), sym.log) but not sym.log(x).is_Log or sym.log(x).is_log:
In [6]: isinstance(sym.log(x), sym.log)
Out[6]: True
In [7]: sym.log(x).is_Log
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [7], in <cell line: 1>()
----> 1 sym.log(x).is_Log
AttributeError: 'log' object has no attribute 'is_Log'
In [8]: sym.log(x).is_log
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [8], in <cell line: 1>()
----> 1 sym.log(x).is_log
AttributeError: 'log' object has no attribute 'is_log'
In order to be consistent ("just one way of doing it"), wouldn't it make sense to only support isinstance(log(x), log) and isinstance(x**2, Pow), but not (x**2).is_Pow?