#15757: Make sage.misc.superseded lazily import sage.rings.integer_ring
-------------------------------------+-------------------------------------
Reporter: nthiery | Owner:
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-6.1
Component: misc | Resolution:
Keywords: | Merged in:
Authors: Nicolas M. ThiƩry | Reviewers: Nathann Cohen
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/nthiery/ticket/15757 | db4e2807f18e3b0e13c5101f4531483ba64b6f91
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by jdemeyer):
`__index__()` converts to a Python `int`, but only if the object really is
a kind of integer. `x.__index__()` is a more strict version of `int(x)`.
For example::
{{{
sage: ZZ(1).__index__()
1
sage: RR(1).__index__()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call
last)
<ipython-input-2-9d1cfb1a099d> in <module>()
----> 1 RR(Integer(1)).__index__()
/usr/local/src/sage-git/local/lib/python2.7/site-
packages/sage/structure/element.so in
sage.structure.element.Element.__getattr__
(sage/structure/element.c:3874)()
/usr/local/src/sage-git/local/lib/python2.7/site-
packages/sage/structure/misc.so in
sage.structure.misc.getattr_from_other_class
(sage/structure/misc.c:1696)()
AttributeError: 'sage.rings.real_mpfr.RealNumber' object has no attribute
'__index__'
sage: "1".__index__()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call
last)
<ipython-input-4-8e5c2bcfbfe8> in <module>()
----> 1 "1".__index__()
AttributeError: 'str' object has no attribute '__index__'
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/15757#comment:10>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.