add isNumerande into generic
This commit is contained in:
parent
4c7ede0956
commit
7d26fd722a
@ -335,6 +335,26 @@ def isPolynom(exp):
|
|||||||
return 0
|
return 0
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
def isNumerande(exp):
|
||||||
|
"""Check is the expression is something we can compute with
|
||||||
|
|
||||||
|
>>> isNumerande(1)
|
||||||
|
1
|
||||||
|
>>> from pymath.polynom import Polynom
|
||||||
|
>>> p = Polynom([1,2])
|
||||||
|
>>> isNumerande(p)
|
||||||
|
1
|
||||||
|
>>> from pymath.fraction import Fraction
|
||||||
|
>>> f = Fraction(12)
|
||||||
|
>>> isNumerande(f)
|
||||||
|
1
|
||||||
|
>>> isNumerande("a")
|
||||||
|
0
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
return isNumber(exp) or isPolynom(exp)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import doctest
|
import doctest
|
||||||
doctest.testmod()
|
doctest.testmod()
|
||||||
|
Loading…
Reference in New Issue
Block a user