So what is the way to display the result of the izip ?
On Tuesday, May 12, 2015 at 7:17:43 PM UTC-5, Anton Sherwood wrote:
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=,
So is functionally izip exactly the same as zip but faster?
As in are the following codes the same?
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)
VS
A = [1,2,3]
B = [a,b]
from itertools import
On 2015-5-12 18:39, Phoenix wrote:
So is functionally izip exactly the same as zip but faster?
NO.
zip() builds a list, an object that takes up space proportional to the
number of entries.
itertools.izip() makes an iterator: a function that generates the items
that would be in the list,
On 2015-5-12 18:42, Phoenix wrote:
I mean after doing either a izip or a zip to create the list k
can I run a loop through k like this ?
for (a,b) in k
Yes, that's what izip is for.
--
*\\* Anton Sherwood *\\* www.bendwavy.org
--
You received this message because you are subscribed to
On 2015-5-12 17:30, Phoenix wrote:
So what is the way to display the result of the izip ?
I changed
print izip(A,X)
to
for j in izip(A,X):
print j
--
*\\* Anton Sherwood *\\* www.bendwavy.org
--
You received this message because you are subscribed to the
I mean after doing either a izip or a zip to create the list k can I run
a loop through k like this ?
for (a,b) in k
--
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
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,
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