This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sransara
Recipients sransara
Date 2021-08-07.19:04:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1628363087.29.0.710236107674.issue44863@roundup.psfhosted.org>
In-reply-to
Content
TypedDict PEP-589 says:
A TypedDict cannot inherit from both a TypedDict type and a non-TypedDict base class.

So the current implementation has:
`if type(base) is not _TypedDictMeta: raise TypeError(...)`

This restricts the user from defining generic TypedDicts in the natural class based syntax:
`class Pager(TypedDict, Generic[T]): ...`

Although PEP 589 doesn't explicitly state generic support, I believe it is complete in covering the specification even if generics were involved (at least for the class based syntax).

I have tried putting together a PEP from guidance of typing-sig <https://github.com/sransara/py-generic-typeddict/blob/master/pep-9999.rst>. There is not much new contributions by that draft, except for specifying the alternative syntax and being more explicit about Generics.

So I'm wondering if it would be possible to relax the constraint: TypedDict inheritance to include Generic. In my point of view `Generic` is more of a mixin, so it doesn't go against the PEP 589. Or is this change big enough to warrant a PEP?
History
Date User Action Args
2021-08-07 19:04:47sransarasetrecipients: + sransara
2021-08-07 19:04:47sransarasetmessageid: <1628363087.29.0.710236107674.issue44863@roundup.psfhosted.org>
2021-08-07 19:04:47sransaralinkissue44863 messages
2021-08-07 19:04:47sransaracreate