MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/ok1itb/tryexcept_in_python_sigh/h55ztw4/
r/badcode • u/lonaExe • Jul 14 '21
93 comments sorted by
View all comments
Show parent comment
4
Pass the dictionary into the default_dict constructor. You’re just responsible for handling what happens when a KeyError would normally happen.
3 u/schmidlidev Jul 14 '21 Oh damn I never realized you could just pass in an existing dict 🤦 that makes things quite a bit easier
3
Oh damn I never realized you could just pass in an existing dict 🤦 that makes things quite a bit easier
View all comments
Show parent comment
4
u/AchillesDev Jul 14 '21
Pass the dictionary into the default_dict constructor. You’re just responsible for handling what happens when a KeyError would normally happen.