Created
August 7, 2024 01:28
-
-
Save ollien/6d19c56e20d6b04449d98ced94a64a5a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 LoudDict(dict): | |
| def __init__(self): | |
| super().__init__() | |
| def __getitem__(self, key): | |
| return super().__getitem__(key).upper() | |
| loud_dict = LoudDict() | |
| loud_dict['hello'] = 'world' | |
| print(loud_dict['hello']) | |
| print(loud_dict.get('hello')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment