Sebastian Rittau
Sebastian Rittau
In theory, there is the [@type_check_only](https://docs.python.org/3/library/typing.html?highlight=type_check_only#typing.type_check_only) decorator, but that has never gained traction.
I'd like to see something like this formalized. But as it concerns stubs and type checkers in general, we should probably move this discussion to typing-sig.
There are currently two ways that this could be implemented. Using `NewType`, which constrains the type: ```python from typing import NewType, cast HTMLString = NewType("HTMLString", str) def print_html(html: HTMLString) ->...
I don't think this change should be dependent on lazy evaluation and generics in the stdlib. Lazy evaluation is already available in all supported Python versions through `from __future__ import...
We should at least fix this in typeshed and add a warning to flake8-pyi, although I agree that the type checker behavior seems inconsistent as well.
There was a related discussion in #1129 about feature flags or a similar field.
I am not sure I understand what you are trying to achieve here. `NotRequired` is currently only applicable to `TypedDict` fields and have no meaning outside them.
I think these issues have been fixed in HEAD.
We could also define a threshold when to show this output. For example, if it got 1.5x slower or 1.5x faster to highlight potential problems. But in general I agree.
I'd personally split these two cases. `None` is probably always a mistake, while I can imagine use cases for `Any`.