How to refactor if-else statements containing dictionaries and default values in Python [closed]
Assuming connectionDetails is a Python dictionary, what's the best practice/most Pythonic way of refactoring code like this? if "host" in connectionDetails: host = connectionDetails["host"] else: host = someDefaultValue
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.