Skip to content

Instantly share code, notes, and snippets.

@pydanny
Last active January 21, 2021 06: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 pydanny/5baa8b0b4547f1bc45dfcc662efc02c0 to your computer and use it in GitHub Desktop.
Save pydanny/5baa8b0b4547f1bc45dfcc662efc02c0 to your computer and use it in GitHub Desktop.
zip = 90213 # common US developer mistake
id = 46
map = Map()
object = MyObject()
obj = MyObject()
object_ = MyObject()
map_obj = Map()
map_ = Map()
zip_code = 90213 # Explicit name with US focus
postal_code = 90213 # i18n explicit name
zip_ = 90213
pk = 46 # pk is often synonymous with id
id_ = 46
true = 0
false = 1
def crazy_api(value):
if value:
return 0
return 1
def adapted_crazy_api(value):
return not bool(crazy_api(value))
try:
result = land_on_mars(value)
except Exception:
pass
try:
result = land_on_mars(value)
except MetricError as e:
log.info("Why is the US still on Imperial measurements?")
result = abort_landing(value)
except Exception as e:
log.error(str(e))
raise MyCustomError(e)
try:
result = land_on_mars(value)
except MetricError as e:
log.info("Why is the US still on Imperial measurements?")
result = abort_landing(value)
except Exception as e:
log.error("I have an error")
raise
language = 'German' if country_code == 'DE' else 'English'
if country_code == 'DE':
language = 'German'
else:
language = 'English'
language = {'DE': 'German'}.get(country_code, 'English')
def crazy_api(value: bool) -> int:
if value:
return 0
return 1
def adapted_crazy_api(value: str) -> bool:
return not bool(crazy_api(value))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment