[CentralOH] More on ex 39, dump()

timothy spencer smashing_good_show at hotmail.com
Sat Dec 6 16:16:55 CET 2014


I think I figured out what the '[0]' is for in that dump() I wrote:

def dump(aMap):
    for bucket in aMap:
        if bucket:
            for k, v in bucket:
                bucket_index = hash_key(aMap, k)
                slot_index = get_slot(aMap, k)[0]
                print bucket_index, slot_index, k, v

With get_slot(), a tuple of 3 items is returned, and putting the [0] there specifies to only have the '0th' item accessed in the tuple for the dump().


 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/centraloh/attachments/20141206/e6c353fb/attachment.html>


More information about the CentralOH mailing list