mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Remove note about Optional still being necessary sometimes (#9687)
This commit is contained in:
@@ -435,7 +435,7 @@ Some further tips for good type hints:
|
||||
* use built-in generics (`list`, `dict`, `tuple`, `set`), instead
|
||||
of importing them from `typing`.
|
||||
* use `X | Y` instead of `Union[X, Y]` and `X | None`, instead of
|
||||
`Optional[X]`, **except** when it is not possible due to mypy bugs (type aliases and base classes);
|
||||
`Optional[X]`;
|
||||
* in Python 3 stubs, import collections (`Mapping`, `Iterable`, etc.)
|
||||
from `collections.abc` instead of `typing`;
|
||||
* avoid invariant collection types (`list`, `dict`) in argument
|
||||
|
||||
Reference in New Issue
Block a user