-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
How should sqlite3.Row be hinted #8027
Comments
The easiest way to use the generic row type for now is to annotate it using |
Is there a case I'm overlooking where being generic like it is now is useful? Outside of the probably rare corner case of all columns in a table having the same type. At which point there still isn't a hint as to how many columns there are. |
Yes, not sure why I made that change; I agree it's likely not useful. I'd be OK with making the class non-Generic again. |
Is there a path forward, maybe after some other expected changes/features in mypy even, towards a more complete solution? If so then the thrash of removing it may not be worthwhile. It has been present in a few recent mypy releases already. If not, then maybe removal would be good. |
There's no currently planned feature that would help here. We'd need something like a TypedDict that is based on an arbitrary class instead of a dict, but that's not a simple feature to add. |
Introduced in python#7641. Removal discussed at python#8027.
sqlite3.Row
was made generic in python/typeshed#7641. With that change I'm not clear how to hint ansqlite3.Row
. It seems that it was made generic against a single type, but many tables will not use the same type for all columns. Also, i have setup to use the dict-like rows which would require typed-dict-like hinting I guess. I didn't see any relevant discussion in the PR.The text was updated successfully, but these errors were encountered: