Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by jgalt212

7 days ago

why not inside of __init__

  self.accessed_keys = set()

instead of

    @property
    def accessed_keys(self):
        return self._accessed_keys

3 comments

jgalt212

Reply

Jaxan  7 days ago

With the @property you only get the “getter” and not the “setter”.

  • eurleif  7 days ago

    But that doesn't accomplish much, because you can still do: `d.accessed_keys.add('foo')`.

    • Jaxan  6 days ago

      That’s right

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities