#19628: lazy_import breaks CachedRepresentation
-------------------------------------+-------------------------------------
       Reporter:  cheuberg           |        Owner:
           Type:  defect             |       Status:  new
       Priority:  major              |    Milestone:  sage-6.10
      Component:  coercion           |   Resolution:
       Keywords:                     |    Merged in:
        Authors:                     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:  u/cheuberg/19152   |       Commit:
  -arb-misc-lazy-import              |  b21aa6e069182b08aca3cf7c24d6ed24e5926510
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Old description:

> `NN` is a lazy_import and therefore we have
> {{{
> sage: NonNegativeIntegerSemiring() == NN
> False
> }}}
> but
> {{{
> sage: NN == NonNegativeIntegerSemiring()
> True
> sage: NonNegativeIntegerSemiring() == NN._get_object()
> True
> }}}

New description:

 `NN` is a lazy_import and therefore we have
 {{{
 sage: NonNegativeIntegerSemiring() == NN
 False
 }}}
 but
 {{{
 sage: NN == NonNegativeIntegerSemiring()
 True
 sage: NonNegativeIntegerSemiring() == NN._get_object()
 True
 }}}

 This gives problems with `CachedRepresentation`:
 {{{
 sage: from sage.misc.lazy_import import LazyImport
 sage: lazyZZ = LazyImport('sage.rings.integer_ring', 'ZZ')
 sage: PolynomialRing(lazyZZ, 'x') is PolynomialRing(ZZ, 'x')
 False
 }}}

--

Comment (by jdemeyer):

 Replying to [comment:12 nbruin]:
 > We could clean up scopes (but that should happen in basically all
 `__all__` files etc.)
 Of course, now the question becomes: which scopes? If you can hand me a
 list of `dict`s which contain all relevant lazy imports, we can indeed do
 something.

 > There are many tickets about this, see e.g. #12482
 Thanks for the pointer, I fixed this.

--
Ticket URL: <http://trac.sagemath.org/ticket/19628#comment:13>
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/d/optout.

Reply via email to