Created
November 4, 2019 10:00
-
-
Save filipwodnicki/df90e710f0212295eb75b02152a254a2 to your computer and use it in GitHub Desktop.
Good code practices
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
# 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