PS: Since this was a recent improvement, the Sage numeric type now register with the pep3141 abstract numbers class so you can (and should) do test like
sage: import numbers sage: isinstance(5, numbers.Integral) True sage: isinstance(5, numbers.Number) True sage: isinstance(5/1, numbers.Integral) False sage: isinstance(22/7, numbers.Rational) True sage: isinstance(1.3, numbers.Real) True sage: isinstance(CC(1.3), numbers.Real) False sage: isinstance(CC(1.3 + I), numbers.Complex) True sage: isinstance(RDF(1.3), numbers.Real) True sage: isinstance(CDF(1.3, 4), numbers.Complex) True sage: isinstance(AA(sqrt(2)), numbers.Real) True sage: isinstance(QQbar(I), numbers.Complex) True On Sunday, January 3, 2016 at 11:01:39 AM UTC+1, Volker Braun wrote: > > The code uses explicit isinstance(.., int) checks, which is rather bad > style. If you don't want to change that then you'll have to pass in a > Python int: BalancedTernary(int(10)) > > > On Sunday, January 3, 2016 at 10:01:15 AM UTC+1, HG wrote: >> >> Hi, >> I got this balanced ternary file from rosetta, it works fine in python2 >> but not completly in sage : b variable which convert number in ternary is >> failing, a problem of conversion but I don't know how to correct it ? >> Any help ? >> Thanks >> Kind regards >> Henri >> > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.