DanielStutzbach/heapdict — pull request #7 by shane-kerr (2014-03-05 23:57:07+00:00)
Title: Make pop() function which matches the documented behavior.

The documentation of the pop() function in the README.rst file does not work, since heapdict inherited the pop() method from the dict class, which requires a key argument:

D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised

I went ahead and added a pop() method that takes no key. I considered making a method that optionally took a key and default return value, but I considered that confusing as then you would have different semantics depending on how the function was called:

1. Without arguments, pop() would use the priority to decide what to remove
2. With arguments, pop() would use the key to decide what to remove

It is of course possible to implement such a function, but in addition to the confusion in semantics, it would be a lot longer. :)