Created
March 15, 2024 19:08
-
-
Save JonathanLoscalzo/96eaff095fce2e44de360a95078b1d27 to your computer and use it in GitHub Desktop.
DictObj alternative for python
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
# Similar to TypedDict but without typings | |
# allow access keys as fields | |
class DictObj: | |
def __init__(self, **kwargs): | |
self._update_internal_dict(dict(kwargs)) | |
def _update_internal_dict(self, data: dict): | |
self.__dict__.update(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment