mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-10-01 15:33:47 +08:00
1 parent
bf3b1f0c4d
commit
bcb8384e2f
1 file changed
+1
-2
+1
-2
@@ -427,8 +427,7 @@ checker, and leave out unnecessary detail:
|
||||
|
||||
Some further tips for good type hints:
|
||||
* use built-in generics (`list`, `dict`, `tuple`, `set`), instead
|
||||
of importing them from `typing`, **except** in type aliases, in base classes, and for
|
||||
arbitrary length tuples (`Tuple[int, ...]`);
|
||||
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);
|
||||
* in Python 3 stubs, import collections (`Mapping`, `Iterable`, etc.)
|
||||
|
||||
Reference in new issue
Block a user