📝 Update all docs references to Optional to use the new syntax in Python 3.10, e.g. int | None (#1351)

This commit is contained in:
Sebastián Ramírez
2025-04-27 20:53:37 +02:00
committed by GitHub
parent 0e5e19773c
commit 61523864f1
15 changed files with 52 additions and 66 deletions

View File

@@ -690,7 +690,7 @@ It would be an error telling you that
> `Hero.age` is potentially `None`, and you cannot compare `None` with `>`
This is because as we are using pure and plain Python annotations for the fields, `age` is indeed annotated as `int | None (or Optional[int])`.
This is because as we are using pure and plain Python annotations for the fields, `age` is indeed annotated as `int | None`.
By using this simple and standard Python type annotations we get the benefit of the extra simplicity and the inline error checks when creating or using instances. ✨