Skip to content

implementation of __getitem__ in PriorityQueue #829

Open
@goswami-rahul

Description

@goswami-rahul

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)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions