| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Seems nice and simple, and it does indeed make no sense from a typing perspective to try to parameterise a non-generic TypedDict
Sorry, something went wrong.
|
This could break users who want to use generic TypedDicts compatible with pre-3.11: if TYPE_CHECKING:
class TD(TypedDict, Generic[T]):
a: T
else:
class TD(TypedDict):
a: T
d: TD[int] = {"a": 1}I think it's safer to keep things unchanged here. |
Sorry, something went wrong.
Agreed. Also, this PR appears to conflict with #27663 , which seems likely to be merged soon. |
Sorry, something went wrong.
|
Forbidding parametrization of non-generic TypedDict types is a side effect of #27663. I created a separate issue to make it clear. If we agree that it should forbidden, we should merge this PR (which also includes tests). If we agree that it should be allowed, we should add other tests, explicitly document this behavior, and change #27663 to keep non-generic TypedDict types parametrizable. |
Sorry, something went wrong.
Why not write if TYPE_CHECKING or sys.version_info >= (3, 11):? |
Sorry, something went wrong.
That would work, but it would be a backward compatibility break. We should let code work on 3.11 unchanged if possible. |
Sorry, something went wrong.
There was a problem hiding this comment.
Let's instead test that subscription works on arbitrary TypedDicts.
Sorry, something went wrong.
|
When you're done making the requested changes, leave the comment: I have made the requested changes; please review again. And if you don't make the requested changes, you will be poked with soft cushions! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Closes #92106.