Mention typing.Never used to type hint empty containers#143876
Mention typing.Never used to type hint empty containers#143876andresdelfino wants to merge 1 commit intopython:mainfrom
Conversation
|
Hmm, why would a user ever want to create a list that must always remain empty? Isn't the whole point of a list, as opposed to a tuple, that lists are mutable? :-) It's true that it's illegal to append anything to a list if the list has type |
|
At least for me it's confusing to read about the different uses for |
|
I believe mypy is the only major type checker that infers |
|
This is if anything a very niche use case and I don't think it needs to be covered in the CPython documentation. It could be mentioned in a more in-depth guide on typing.python.org. |
|
Thanks for the PR @andresdelfino but I think we'll decline this one. There's a lot of value in keeping these docs relatively concise, and it sounds like Jelle and I are aligned in thinking that this doesn't quite meet the bar :-) |
I saw this behavior from mypy, but I guessed it was safe to assume it is an intended semantic.
📚 Documentation preview 📚: https://cpython-previews--143876.org.readthedocs.build/