It essentially returns the same key if it is present, else returns None (doesn't raise Exception).
Is this the intended use?
def __getitem__(self, key):
for _, item in self.A:
if item == key:
return item
Also, the documentation of PriorityQueue says
It supports dict-like lookup.
What exactly is the method __getitem__ trying to do (and return)?
It essentially returns the same
keyif it is present, else returns None (doesn't raise Exception).Is this the intended use?
Also, the documentation of PriorityQueue says
It supports dict-like lookup.What exactly is the method
__getitem__trying to do (and return)?