How is the Implementation of Python's dictionaries done?

Questions by fred   answers by fred

Showing Answers 1 - 9 of 9 Answers

tomanihskb

  • Feb 10th, 2009
 

A hash value of the key is computed using a hash function, The hash value
addresses a location in an array of "buckets" or "collision lists" which
contains the (key , value) pairs.  The collision list addressed by the hash
value is searched sequentially until a pair is found with pair[0] == key. There
turn value of the lookup is then pair[1].

  Was this answer useful?  Yes

Vivek Barkul

  • Sep 14th, 2017
 

Python dictionary needs to be declared first:
objDict = { }
Key value pair can be added as:
objDict[key] = value
or
objDict.update({key:value})
remove element by:
objDict.pop(key)
remove all:
objDict.clear()

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions