Created
June 2, 2020 06:15
-
-
Save lostmsu/6d53e5340319a85e45db01857cc6ed61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> class MyList(list): | |
... def __getitem__(self, idx): | |
... print('hello') | |
... return super().__getitem__(idx) | |
... | |
>>> l = MyList() | |
>>> l.append(42) | |
>>> l[0] | |
hello | |
42 | |
>>> isinstance(l, list) | |
True | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment