<div dir="ltr">did you use this:<p class="p1"><span class="s1">number_of_lists = 4<br>numbers = range(10)<br>print list( itertools.product(*[numbers]*number_of_lists))</span></p><p class="p1"><br></p><p class="p1"><span class="s1">Yields a list from 1,1,1,1 to 9,9,9,9 given that all lists are identical in content.<br>number of lists and length of list are variable.<br>Inner ranges could be iterators too, to avoid having memory chewed up by <br>Note, the above example lets memory be consumed by list() and range(). </span></p><p class="p1"><span class="s1"><br></span></p></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jul 17, 2015 at 7:38 AM Carl Karsten <<a href="mailto:carl@personnelware.com">carl@personnelware.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div> def __init__(self, int1 = 1, int2 = 1, int3 = 1, int4 = 0):<br> self.int1 = int1<br> self.int2 = int2<br> self.int3 = int3<br> self.int4 = int4<br><br></div>1,2,3,4 hard coded is generally a red flag that you should be using a list.<br><br></div>I didn't look at what the code is doing, but you should be able to replace all the int1 with i[1]<br><div>(don't use int[1], int is a reserved word)<br><br></div><div>Step 2: Once you have that working, you should be able to replace all the 1,2,3,4's with for n in range(1,5): i[n]<br><br><br></div></div><div class="gmail_extra"></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 17, 2015 at 12:30 AM, Lewit, Douglas <span dir="ltr"><<a href="mailto:d-lewit@neiu.edu" target="_blank">d-lewit@neiu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font size="4">I think this works! Yay!!! Although I would like to make it more general for any integer n besides 4. Do I really need int1, int2, int3, int4? I think all I need is the initial vector = [1, 1, 1, 1, ......, 0].</font><div><font size="4"><br></font></div><div><font size="4">Gotta go! Oh yeah, code here is in Python 3. Not sure how well it will run in Python 2. I don't know when Python 4 is coming out, but if it's not backward compatible with Python 3 I have a feeling A LOT of folks in the Python community are going to be very, very upset!</font></div><div><font size="4"><br></font></div><div><font size="4">Best,</font></div><div><font size="4"><br></font></div><div><font size="4">Doug.</font></div></div>
<br>_______________________________________________<br>
Chicago mailing list<br>
<a href="mailto:Chicago@python.org" target="_blank">Chicago@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/chicago" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/chicago</a><br>
<br></blockquote></div><br><br clear="all"><br></div><div class="gmail_extra">-- <br><div><div dir="ltr"><div><div dir="ltr"><div>Carl K<br><br></div></div></div></div></div>
</div>
_______________________________________________<br>
Chicago mailing list<br>
<a href="mailto:Chicago@python.org" target="_blank">Chicago@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/chicago" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/chicago</a><br>
</blockquote></div>