3 ms·
I haven't even used Python for like four years now, but all of these suggestions to do try except and get.key() or {} seem to be ignoring that Python has had a
by nonameiguess 3y ago
I haven't even used Python for like four years now, but all of these suggestions to do try except and get.key() or {} seem to be ignoring that Python has had a defaultdict in the standard library for, I don't even know, at least the last decade and a half, as long as I've been paying attention. It's even written in C: https://github.com/python/cpython/blob/d9246c7b734b8958da03494045208681d95f5b74/Modules/_collectionsmodule.c#L1931 https://github.com/python/cpython/blob/d9246c7b734b8958da034....
- rwestergren 3y agodefaultdict doesn't seem to easily solve for the main topic of deeply nested values.