Hi all:

I want to check if an expression A is a complex number?  I tried the
obvious

sage: if A in CC:
              print "Yep."

but that doesn't work.  For instance,

sage: sqrt(2) in CC:
False

One method that does work is

sage: try:
             CC(A)
          except:
              print "Nope"
          else:
              print "Yep"

but is there a simpler way?

Alex
--~--~---------~--~----~------------~-------~--~----~
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-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to