He asked about floats. 1/2 is no float ...
But you can do:
re.search("\.|/","1/2")
> Ondrej asked how to distinguish Sage Integers from floats "without
> knowing about Sage". I don't know exactly what this means. But,
> Ondrej, would it be an acceptable solution for you to check whether
He didn't specify exactly. But I think, using code from SAGE like ZZ
is forbidden.
Also, it wouldn't be nice to rely on implementation details in SAGE.
>
> Would it be a solution for you to explicitly test the types? Say,
> sage: def IntTest2(t):
> ....: return isinstance(t,Integer) or isinstance(t,int) or
> isinstance(t,long)
This is unpythonic. You should in general avoid calls to isinstance
( I did it to often in past).
You can google for "Duck typing".
Michael
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---