Does your show() do operations on the input other than "for item in inputlist"?

I replaced the meat of your loop with
        print "X=", X
        print "k=", zip(A,X)
        print "ik=", izip(A,X)

and this was the output of the first iteration:
        X= ('a', 'b', 'a')
        k= [(1, 'a'), (2, 'b'), (3, 'a')]
        ik= <itertools.izip object at 0x2c6288>

On 2015-5-12 16:56, Phoenix wrote:

I was under the impression that izip is a better alternative than zip
when the two sets are large.
But thats not what its turning out to be.
(in practice I would have A to be a set of size ~200-300 and B would be
of size ~10-50 )

A = [1,2,3]
B = ["a","b"]
from itertools import product
from itertools import izip

for X in product(B,repeat = len (A)):
     k = izip(A,X)
     show(k)

[THE ABOVE izip  VERSION DOESN'T WORK!]

VS

A = [1,2,3]
B = ["a","b"]
from itertools import product

for X in product(B,repeat = len (A)):
     k = zip(A,X)
     show(k)

[THE ABOVE zip VERSION WORKS]

Can someone help?


--
*\\*  Anton Sherwood  *\\*  www.bendwavy.org

--
You received this message because you are subscribed to the Google Groups 
"sage-support" 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-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to