[CentralOH] The enumerate() solution
timothy spencer
smashing_good_show at hotmail.com
Sun Dec 7 18:31:12 CET 2014
I think I have figured out how to list all the desired elements using enumerate(). I set the number of buckets to 8, and here is what I did:
def dump(aMap):
for index, bucket in enumerate(aMap):
for i, slot in enumerate(bucket):
print(index, i, slot)
What printed out then was the index for the bucket, the index for the slot, and then the key/value pair in the slot. It doesn't appear that the 'if' statements that Zed uses are necessary in my code. I am guessing it's because I am not having 'bucket' printed out in the first for-loop.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/centraloh/attachments/20141207/fbf5d081/attachment.html>
More information about the CentralOH
mailing list