Skip to content

Instantly share code, notes, and snippets.

@sjvrijn
Created February 4, 2020 21:35
Show Gist options
  • Save sjvrijn/3de054a81756a757f39b6ddafd71bc1a to your computer and use it in GitHub Desktop.
Save sjvrijn/3de054a81756a757f39b6ddafd71bc1a to your computer and use it in GitHub Desktop.
# source: https://twitter.com/Pen_Bird/status/1218965711780904960
# it supports map['foo'] = 42, AND http://map.foo = 42, because its __dict__ is itself
class Map(dict):
def __init__(self, **kwargs):
super(Map, self).__init__(**kwargs)
self.__dict__ = self
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment