mirror of
https://github.com/fastapi/sqlmodel.git
synced 2026-03-13 09:29:54 +08:00
📝 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:
committed by
GitHub
parent
0e5e19773c
commit
61523864f1
@@ -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. ✨
|
||||
|
||||
|
||||
Reference in New Issue
Block a user