Possible Duplicate:
Finding the index of a list in a loop
Assume you have a list, where not just the values have meaning, the index has, too.
counts = [3,4,5,3,1]
Let's say that means "we have 3 objects of type zero, 4 objects of type 1 and so on".
You want to create a list of objects from that and give these objects both information details:
[CountObject(amount=a,type=???) for a in counts]
How would you do that?