#19319: iterator over pairs on diagonals a la Cantor pairing
-------------------------------------+-------------------------------------
Reporter: dkrenn | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.9
Component: misc | Resolution:
Keywords: | Merged in:
Authors: Daniel Krenn | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/dkrenn/product_cantor_pairing | 17229c620b4aff47161b725de2ebb4f890cfc2af
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by ncohen):
If you don't care, I just gave it a try:
{{{
def product(A,B):
B = iter(B)
lb = []
b_done = False
for a in A:
try:
if not b_done:
lb.append(B.next())
except StopIteration:
b_done = True
for b in lb:
yield (a,b)
}}}
Does the job.
Nathann
--
Ticket URL: <http://trac.sagemath.org/ticket/19319#comment:5>
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.