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 additional examples about TypeIs #1814

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mikeshardmind
Copy link

This is a followup from discussion on discourse, and specifically this example which was constructed with the help of many going back and forth to determine a situation that could have a parallel in real world code, and which was possibly unsound. To not overly deter users from using this when it is appropriate, counter examples of "tolerably safe" narrowing functions that operate on generic types are included.

@srittau srittau added Typing Council decision Needs to be approved by the Typing Council. Do not merge until approved. topic: typing spec For improving the typing spec labels Jul 21, 2024
@mikeshardmind
Copy link
Author

I'm not sure why the typing council decision label was added to this, this is purely an extended example of existing behavior to help better document the sharp edges that already exist on a typing feature and not a specification change, which does not appear to need one.

Quoting: https://github.com/python/typing-council/blob/main/README.md

The Council makes decisions in response to issues opened on this repo. Such decisions include:

If there's anything I need to do to have this proceed, please let me know.

@JelleZijlstra
Copy link
Member

This PR is to the spec, but I'm not sure why this text needs to be in the spec; it doesn't seem to specify any additional behavior. It might be a better fit for the guide on type narrowing that I added recently.

@erictraut
Copy link
Collaborator

Reviewing the proposed addition, I don't think this belongs in the typing spec. The typing spec is intended to specify how the type system works and how type checkers must behave. The proposed addition doesn't serve this purpose. It is instead directed at users of TypeIs. It therefore belongs in the typing guide, not the typing spec.

@mikeshardmind
Copy link
Author

Hmm. I thought placing it next to the existing example of behavior around TypeIs would make more sense, but I can retool the PR to move it to the guide, thanks for the feedback.

@srittau srittau removed Typing Council decision Needs to be approved by the Typing Council. Do not merge until approved. topic: typing spec For improving the typing spec labels Aug 5, 2024
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.

4 participants