I think this is b/c I am running 2.5. I also have 2.6 but i am using
2.5 for gnupoly and an older audio lib i have.
I ran the listcom below on 2.6 and it worked, so i just have to figure
out how that can be written for 2.5. I guess
2.6 has an update to enumerate.
-k
On Aug 29, 2009, at 2:21 AM, afit...@gmail.com wrote:
Enumerate() is returning a tuple, I haven't tested this code but try:
[[x[0],x[1]] for x in enumerate(blah,1)]
------Original Message------
Sender: tutor-bounces+afith13+python=gmail....@python.org
To: tutor@python.org
Subject: Re: [Tutor] packing a list of lists
Sent: Aug 28, 2009 9:49 AM
Thanks for the replies. Though the list comprehension does not work:
TypeError: enumerate() takes exactly 1 argument (2 given)
On Aug 29, 2009, at 12:20 AM, vince spicer wrote:
#print foohough I didn't test your code, I think what you are
trying to accomplish can be done using enumerate cleaner
def pack(foo):
out = []
for x,y in enumerate(foo, 1):
out.append((x,y))
return out
Or even cleaner with list comprehension
def pack(foo):
return [x for x in enumerate(foo, 1)]
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor