Sebastian Rittau

Results 518 comments of Sebastian Rittau

Another example where this could be beneficial, from typeshed: ```python _T = TypeVar("_T", default=None) def nullcontext(enter_result: _T = ...) -> ContextManager[_T]: ... ``` At the moment this uses an overload.

There are currently no plans to remove the aliases from `typing`. But using the built-in generics - if possible - is certainly more future-proof. For now, it's perfectly fine to...

And just to clarify: I expect that the aliases will be removed at some point, but I don't think we will even start to issue deprecation warnings before the end...

Good idea for a quick fix.

Related: [PEP 661](https://www.python.org/dev/peps/pep-0661/) -- Sentinel Values

> * discuss.python.org > * I could tweet if you think it'd be useful. Added to the list above.

I have now posted to python-list and at discuss.python.org.

That is a clever trick that works for some functions like `assert_is_instance()`, but in the examples given it does not work, since it ignores the non-type check part. Another example...

Implemented by [PEP 647](https://www.python.org/dev/peps/pep-0647/).