Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example with overlap to overload #1737

Closed
wants to merge 1 commit into from
Closed

Add example with overlap to overload #1737

wants to merge 1 commit into from

Conversation

nineteendo
Copy link

@nineteendo nineteendo changed the title Add example with overlap Add example with overlap to overload May 16, 2024
@srittau
Copy link
Collaborator

srittau commented May 16, 2024

I'm not part of the typing council, but while this is good advice, I don't think the spec is the correct place for it. This would probably be best placed in a tutorial (once we got one) or maybe one of the guides.

@nineteendo
Copy link
Author

Quoting @JelleZijlstra:

We don't change old PEPs. New examples should either be added to the CPython documentation (in this case, Doc/library/typing.rst) or the typing spec in https://github.com/python/typing.

@hauntsaninja
Copy link
Collaborator

This specific change reads like user-facing documentation, so I agree it doesn't fit in the spec. The guides and user facing documentation are in: https://github.com/python/typing/tree/main/docs/source (type checkers also have their own version of these, e.g. the mypy user facing docs are usually pretty good)

To my knowledge the spec does not mandate linting overlapping overloads at all. As a hard prerequisite for this, the spec would need to mandate the overload resolution ordering, which we don't currently do.

@nineteendo
Copy link
Author

As far as I can tell, that would require a new section, so I would need help with that. And mypy doesn't mention defaults either: https://mypy.readthedocs.io/en/stable/more_types.html#type-checking-the-variants
For some reason I thought ... should also be used if the default was incompatible with the type.

@nineteendo nineteendo closed this May 16, 2024
@nineteendo nineteendo deleted the patch-1 branch May 16, 2024 19:12
@nineteendo
Copy link
Author

Do we fix it here, or should this be addressed in the mypy documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants