Am 21.06.2014 11:19, schrieb Saurabh Jha:
I think we can make regular expressions that will match Integers, floating
points etc. Something along the lines of this
for int -> re.compile('^\d+$')
for float -> re.compile('^\d+\.\d+$')
What do you think about it?
First, it' unnecessarily slow.
Just check whether f == round(f) for floats.
Second, the question whether a float is integral or not borders on
madness - you never know whether the answer "it's a natural number"
comes from the round-off lottery or is genuine.
Third, regular expressions aren't going to give any meaningful results
for symbolic expressions, and the "Sym" in SymPy defines its mission
statement: symbolic math.
If you pursue a way to find out whether a *symbolic expression* is in
ZZ, QQ, Complex, or whatever, then that would be worth thinking about.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/53A59B84.6000408%40durchholz.org.
For more options, visit https://groups.google.com/d/optout.