Skip to content

Instantly share code, notes, and snippets.

@jasperkennis
Created September 3, 2014 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasperkennis/11446afca2fc17bd0d75 to your computer and use it in GitHub Desktop.
Save jasperkennis/11446afca2fc17bd0d75 to your computer and use it in GitHub Desktop.
Python object types as dict key demo
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