#12788: Provide Integer class with a __format__ method
--------------------------------+-------------------------------------------
Reporter: nbruin | Owner: AlexGhitza
Type: enhancement | Status: new
Priority: trivial | Milestone: sage-5.0
Component: basic arithmetic | Keywords:
Work issues: | Report Upstream: N/A
Reviewers: | Authors:
Merged in: | Dependencies:
Stopgaps: |
--------------------------------+-------------------------------------------
It was observed in
[http://groups.google.com/d/topic/sage-support/OEHb5aIjBIQ/discussion this
sage-support thread] that Python new-style format specifiers for Sage
Integers don't work. The solution is easy: Equip Integer with a
`__format__` method that simply converts the Sage Integer to a Python int
and then calls the `__format__` method on that. Given that converting a
GMP int to a Python int should be much cheaper than converting either to a
string, I don't expect much of a performance penalty, and implementing the
whole Format mini-language again seems a waste of effort.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12788>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
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-trac?hl=en.