-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
From #14027
The form Incomplete | None = None is basically a holdover from before we included defaults in stubs, where Incomplete | None = ... provided extra information.
This is still interpreted as
Any | Noneby mypy. And now more correctly interpreted asUnknown | Noneby pyright.
Unknown | None instead of Any | None sounds like this would be worth it alone. I also like that this form would be more succinct, while being quite obvious.
@Avasam also wrote:
Some stubs might also use it in select places specifically to pass
pyrightconfig.stricter.json
This is something we need to look out for, but is - in my opinion - not a valid reason not to do this. Marking something as "strict" when it's using Incomplete is cheating anyway, and we don't allow bare Incomplete statements.
Whatever we decide, we should enforce the style using flake8-pyi.
If we change this, we should also ask mypy to change stubgen to follow this style.