2π is not a number
The long-expected sequel to the popular π is not a number:
from symengine import pi
print((2*pi).is_number)
is_number returns None for 2*pi, though it should be True.
Also, there seem to be is_number and is_Number, which work differently is at least confusing.
is_number and is_Number difference is consistent with sympy. Names with capitals indicate a class and the attribute is true only if the expression is an instance of that class
I guess is_number can be defined as an expression without Symbol, FunctionSymbol instances in the expression tree.
There is a difference between sympy and symengine here:
> import symengine
> (2*symengine.pi).is_number
None
but
> import sympy
> (2*sympy.pi).is_number
True
I think symengine should do what sympy does.
The SymPy is_number attribute is confusingly named but basically means "this expression can be evaluated using .evalf() to give a complex floating point number". There is a related also confusingly named attribute "is_comparable" which means "this expression can be evaluated to a real floating point number".
The usage is that you can check with something like:
if expr.is_number:
expr_approx = expr.evalf()
...
It is not enough just to check for symbols in the expression tree because it should also represent a number e.g.:
In [2]: ImmutableMatrix([[1, 2], [3, 4]]).is_number
Out[2]: False