8000 Use `TypeAlias` for types in `sqlite3.dbapi2` by sobolevn · Pull Request #9158 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Use TypeAlias for types in sqlite3.dbapi2 #9158

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

Closed
wants to merge 2 commits into from

Conversation

sobolevn
Copy link
Member

No description provided.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@sobolevn
Copy link
Member Author

Btw, I've found many more missing type aliases in other modules via my custom query.

Are you interested in annotated them?

@JelleZijlstra JelleZijlstra self-requested a review November 11, 2022 13:16
@AlexWaygood
Copy link
Member

What benefits does this PR bring?

There are some differing opinions on exactly when TypeAlias should be used in stubs -- e.g. #8256 (comment)

@sobolevn
Copy link
Member Author
sobolevn commented Nov 11, 2022

I've just seen @srittau's comment on his vision of TypeAlias. Mine is completely different.

I see TypeAlias as a way to say: these things are both types and they are the same thing.

Consider these lines:

x = 1
def some(): ...
class T: ...

y = x
other = some
T1 = T
T2: TypeAlias = T

Here we can notice that y, other, and T1 are assignments. But, we cannot be sure what their values are (until we go and see, it is even more complicated when different name schemes are used like error = _SomeError).

But, TypeAlias gives us strong guarantee: these two are just different names for a single type.

But, feel free to close if this is not something you want, I don't have a strong opinion.

@JelleZijlstra
Copy link
Member

I'd also be hesitant to make a change here unless there's a clear problem being fixed.

@JelleZijlstra JelleZijlstra removed their request for review November 12, 2022 01:32
@AlexWaygood
Copy link
Member

Let's close this for now

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
0