Skip to content

Instantly share code, notes, and snippets.

@filipwodnicki
Created November 4, 2019 10:00
Show Gist options
  • Save filipwodnicki/df90e710f0212295eb75b02152a254a2 to your computer and use it in GitHub Desktop.
Save filipwodnicki/df90e710f0212295eb75b02152a254a2 to your computer and use it in GitHub Desktop.
Good code practices
# 1. Use f-strings
#instead of this
name = 'projects/{}/locations/us-central1/models/{}'.format(project_id, model_id)
# do this
name = f'projects/{project_id}/locations/us-central1/models/{model_id}'
# 2. Explicitly name errors:
# instead of this
try:
import google.colab
return True
except:
# do this
try:
import google.colab
return True
except ModuleNotFoundError:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment