Opened 19 months ago
Closed 18 months ago
#27694 closed enhancement (fixed)
Make L.<x> syntax work for LazyLaurentSeriesRing
Reported by:  slelievre  Owned by:  

Priority:  major  Milestone:  sage8.8 
Component:  algebra  Keywords:  
Cc:  klee, slelievre, tscrim  Merged in:  
Authors:  Kwankyu Lee  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  3f28452 (Commits)  Commit:  3f284520d005e9863381407dc58cd79015e464df 
Dependencies:  Stopgaps: 
Description
Following #27347, one can use
sage: from sage.rings.lazy_laurent_series_ring import LazyLaurentSeriesRing sage: L = LazyLaurentSeriesRing(ZZ, 'z') sage: x = L.gen()
It would be nice to have the syntactic sugar
sage: L.<x> = LazyLaurentSeriesRing(ZZ)
work, just as it does for nonlazy:
sage: L.<x> = LaurentSeriesRing(ZZ)
The Sage preparser actually transforms the L.<x>
input as follows:
sage: preparse('L.<x> = LazyLaurentSeriesRing(ZZ)') "L = LazyLaurentSeriesRing(ZZ, names=('x',)); (x,) = L._first_ngens(1)"
so methods gens
and _first_ngens
are needed for LazyLaurentSeriesRing
.
Change History (15)
comment:1 Changed 19 months ago by
 Cc tscrim added
comment:2 Changed 19 months ago by
comment:3 followup: ↓ 4 Changed 19 months ago by
It is the case for LazyPowerSeriesRing
, so that would be consistent.
comment:4 in reply to: ↑ 3 Changed 19 months ago by
Replying to slelievre:
It is the case for
LazyPowerSeriesRing
, so that would be consistent.
I fear that it increases startup time. Perhaps using lazy_import
is necessary.
comment:5 Changed 19 months ago by
Maybe that is the case for LazyPowerSeriesRing
too? I don't know how to check that...
comment:6 Changed 19 months ago by
Doesn't look like it's lazily imported, see the third hit in the search:
sage: search_src('import', 'LazyPowerSeriesRing') categories/highest_weight_crystals.py:378: from sage.combinat.species.series import LazyPowerSeriesRing categories/sets_with_grading.py:217: from sage.combinat.species.series import LazyPowerSeriesRing combinat/species/all.py:6:from .series import LazyPowerSeriesRing combinat/species/generating_series.py:81:from .series import LazyPowerSeriesRing, LazyPowerSeries combinat/species/series.py:51: sage: from sage.combinat.species.series import LazyPowerSeriesRing
comment:7 Changed 19 months ago by
 Branch set to u/klee/27694
 Commit set to bdfc88b534d4bf0fc6a77a6e1a67988b7f62cd2e
New commits:
bdfc88b  Make L.<z> work

comment:8 Changed 19 months ago by
It's not lazily imported yet. Let's see how this affects the startup time first.
comment:9 Changed 19 months ago by
I would just lazily import it. There is no real harm in doing that. It just might take a moment to load when first using it in Sage. It is quite difficult to see how a single import changes startup time (unless it is really big); it is a "death by a 1000 needles" thing where it is the culmination of all the different modules.
comment:10 Changed 19 months ago by
 Commit changed from bdfc88b534d4bf0fc6a77a6e1a67988b7f62cd2e to 084c44f2c938dd192d9abd36f24b7ae1baf7a97f
Branch pushed to git repo; I updated commit sha1. New commits:
084c44f  Change x to z

comment:11 Changed 19 months ago by
 Commit changed from 084c44f2c938dd192d9abd36f24b7ae1baf7a97f to 3f284520d005e9863381407dc58cd79015e464df
Branch pushed to git repo; I updated commit sha1. New commits:
3f28452  Switch to lazy_import

comment:12 Changed 19 months ago by
Ready for review?
comment:13 Changed 19 months ago by
 Status changed from new to needs_review
comment:14 Changed 18 months ago by
 Reviewers set to Travis Scrimshaw
 Status changed from needs_review to positive_review
LGTM.
comment:15 Changed 18 months ago by
 Branch changed from u/klee/27694 to 3f284520d005e9863381407dc58cd79015e464df
 Resolution set to fixed
 Status changed from positive_review to closed
Does your proposal include importing
LazyLaurentSeriesRing
at startup time?