In reply to @mountain_ghosts

@jcoglan a first attempt: dict['a'] = dict.get('a',0). I feel there's a slightly more obvious way though

0 favourites 0 retweets

In reply to @christianp

@christianp @jcoglan in fact, two lines lower in the docs: dict.setdefault('foo',0). docs.python.org/library/stdtyp…

0 favourites 0 retweets

View this tweet on twitter.com

This tweet as JSON