Skip to content

Commit

Permalink
馃摑 Compare enum with identity instead of equality
Browse files Browse the repository at this point in the history
> Enumeration members are compared by identity
https://docs.python.org/3/library/enum.html#comparisons
  • Loading branch information
MicaelJarniac committed May 13, 2022
1 parent 31690dd commit 1547f41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs_src/path_params/tutorial005.py
Expand Up @@ -14,7 +14,7 @@ class ModelName(str, Enum):

@app.get("/models/{model_name}")
async def get_model(model_name: ModelName):
if model_name == ModelName.alexnet:
if model_name is ModelName.alexnet:
return {"model_name": model_name, "message": "Deep Learning FTW!"}

if model_name.value == "lenet":
Expand Down

0 comments on commit 1547f41

Please sign in to comment.