On Saturday, March 24, 2012 11:01:15 PM UTC-7, Dima Pasechnik wrote:
> Given that not every Integer fits into an int, this would be asking for
> trouble. Rather, Sage should specify its own format for Integer, etc.
>
true, but Python handles the overflow gracefully by returning a long
instead, and in Python 3 there is no int/long dichotomy on the language
level any more. It's probably convenient to put a __format__ method on
Integer, but its implementation could be very simple:
def __format__(self,*args,**kwargs):
return int(self).__format__(*args,**kwargs)
If this leads to performance issues, one could consider writing a custom
version that accepts the python format mini-language.
--
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
URL: http://www.sagemath.org