#13778: lazy list
-------------------------------------+--------------------------------------
Reporter: vdelecroix | Owner: jason
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-5.6
Component: misc | Resolution:
Keywords: list, iterator | Work issues:
Report Upstream: N/A | Reviewers: Travis Scrimshaw
Authors: Vincent Delecroix | Merged in:
Dependencies: | Stopgaps:
-------------------------------------+--------------------------------------
Old description:
> Lazy lists are iterators that behave like `list` and implement a cache
> mechanism.
>
> Apply only apply trac_13778-lazy_list.patch
New description:
Lazy lists are iterators that behave like `list` and implement a cache
mechanism.
Apply only: trac_13778-lazy_list.patch, trac_13778-lazy_list-review-
ts.patch
--
Comment (by tscrim):
Hey Vincent,
I like this implementation much better.
I've added a few tests and tweaked documentation, but I've changed the
behavior of `list()` slightly by not checking if stop was large since I
did not like the following behavior:
{{{
sage: L = lazy_list([0,1]); L
lazy list [0, 1]
sage: L.list()
Traceback
...
ValueError: stop is too large!!
}}}
There definitely is a problem with determining when iterators are infinite
throughout sage (for example, `vector(RR, QQ)` in ticket #13556), however
I'd rather have finite lazy lists always have a `list()` method not raise
an exception.
I've also added a check if the input to lazy list is a list or tuple, then
it sets `stop` to the length of the list if `stop` was not specified.
If you agree with the changes, feel free to set this to positive review.
Best,[[BR]]
Travis
------
For patchbot:
Apply: trac_13778-lazy_list.patch, trac_13778-lazy_list-review-ts.patch
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13778#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 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.