Created
September 3, 2014 08:04
-
-
Save jasperkennis/11446afca2fc17bd0d75 to your computer and use it in GitHub Desktop.
Python object types as dict key demo
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
return { | |
Country: self.fetch_country(city), | |
Region: self.fetch_region(city), | |
City: self.fetch_city(city), | |
None: None | |
}[type(location)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment