summaryrefslogtreecommitdiff
path: root/3 Resources/Python/__getitem__ __setitem__.md
blob: 03c890eb68092f6cd5c412289ad27c321552178c (plain)
1
2
3
4
5
---
tags:
  - python
---
To have a class behave as a dict it's possible to add the two magic methods `__getitem__(self, key)` and `__setitem__(self, key, val)`.