#19319: iterator over products on diagonals a la Cantor
-------------------------+-------------------------------------------------
Reporter: | Owner:
dkrenn | Status: needs_review
Type: | Milestone: sage-6.9
enhancement | Resolution:
Priority: major | Merged in:
Component: misc | Reviewers: Daniel Krenn, Clemens Heuberger
Keywords: | Work issues:
Authors: | Commit:
Vincent Delecroix | 1fee7226728e5ec09ffdeb1acdb59c2aad1dc7d5
Report Upstream: N/A | Stopgaps:
Branch: |
u/cheuberg/19319 |
Dependencies: |
-------------------------+-------------------------------------------------
Comment (by vdelecroix):
Replying to [comment:39 cheuberg]:
> Replying to [comment:33 vdelecroix]:
> > 26 lines and no recursion.
>
> thanks --- however, using `IntegerListsLex` amounts to a little cheating
with respect to the length of this routine `;-)`.
Sure. But the moto is "not reinvent the wheel".
> Any particular reason that you return lists instead of tuples?
Good question. `itertools` used to output tuples. But sometimes you want
to play with the result (like appending some more elements). For me it is
fine either way.
Replying to [comment:36 nbruin]:
> Perhaps consider using `sage.misc.lazy_list.lazy_list` as a cache? That
should save you making explicit appends. You could even get slightly
better memory use for cartesian powers (a common case) by sharing caches.
Using lazy list you would also need to catch `IndexError` or so until we
use the Cython API I would not go with it.
I will add a trivial commit for handling sharing of slices (very good
idea!).
Vincent
--
Ticket URL: <http://trac.sagemath.org/ticket/19319#comment:40>
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.