Skip to content

Typing LRU Cache - Part 2 #1256

Discussion options

You must be logged in to vote

Oh my lord, I suppose there are times when my hand isn't big enough for the face palm I want to give myself:

class LRU(OrderedDict):
    def __init__(
        self,
        *args: object,
        max_size: int = 128,
        **kwargs: object,
    ) -> None:
        self.max_size = max_size
        super().__init__(*args, **kwargs)

For all intents and purposes, the above should work just fine. Here it is on the mypy playground for future readers who want to see this in action.

Sorry everyone!

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by adam-grant-hendry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant