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

Consider creating a UninferableType or _Uninferable class #1680

Closed
DanielNoord opened this issue Jun 30, 2022 · 2 comments · Fixed by #1741
Closed

Consider creating a UninferableType or _Uninferable class #1680

DanielNoord opened this issue Jun 30, 2022 · 2 comments · Fixed by #1741
Labels
Discussion 🤔 Maintenance Discussion or action around maintaining astroid or the dev workflow
Milestone

Comments

@DanielNoord
Copy link
Collaborator

I opened microsoft/pyright#3641 as I wondered why pyright didn't recognise how we type Uninferable. Normally they are a little bit more up to date than mypy so I wondered if this was intentional.

Turns out it is. According to them, the way we currently handle the typing of Uninferable is incorrect and should ideally be refactored.
As we're stille early days into the typing of astroid I think there is still chance to do this.

Their suggestion is to create a private class (_Uninferable) which Uninferable can then instantiate. One of the issues with this is that we tend to require Uninferable as a type in pylint as well and so we would need to import that private class as well.
We could also create a public class, perhaps suffixed with Type, which we document as only being useful for typing.

Let me know if you guys thinks this is something we should do and what approach is best.

/CC @cdce8p As you're likely interested in this.

@DanielNoord
Copy link
Collaborator Author

@jacobtylerwalls Do you have a preference for either of the two solutions?

@jacobtylerwalls
Copy link
Member

I think UninferableType is more clear. I wish PEP 661 had an implementation.

@cdce8p cdce8p mentioned this issue Nov 14, 2022
10 tasks
@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 2.13.0, 2.14.0 Nov 19, 2022
@cdce8p cdce8p modified the milestones: 2.14.0, 2.15.0 Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion 🤔 Maintenance Discussion or action around maintaining astroid or the dev workflow
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants