On 3/11/07, Robert Miller <[EMAIL PROTECTED]> wrote:
>
> Say I want a function to return a rational, and I have the integers
> for numerator and denominator. Right now, I have to call the Rational
> constructor twice:
>
> return Rational(self.size())/Rational(n)
>
> It seems natural to have something like
>         elif isinstance(x, tuple):
>             ......
>
> around line 165 or so in rational.pyx, to allow something like
>
> return Rational(  (self.size()  ,  n)  )
>
> Does anyone mind if I implement this?

Yes, please do that.   Alternatively, just do
     Integer(self.size()) / Integer(n)
since a quotient of two integers is *guaranteed* to be a rational.

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to