Created
March 31, 2017 07:15
-
-
Save richmondwang/7e4704c585af7c41f23dcbe790ec2cfb to your computer and use it in GitHub Desktop.
Creates a dict whose top-level keys are always evaluated to str.
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 StringedDict(dict): | |
def __setitem__(self, key, value): | |
super().__setitem__(str(key), value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment