#32156: Add __class_getitem__ to support runtime type parameters for more
classes
-------------------------------------+-------------------------------------
Reporter: Brady Kieffer | Owner: Brady
| Kieffer
Type: New feature | Status: closed
Component: Utilities | Version: 2.2
Severity: Normal | Resolution: needsinfo
Keywords: types, mypy, | Triage Stage:
django-stubs | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):
* status: assigned => closed
* resolution: => needsinfo
Comment:
Hi Brady. Thanks for the follow-up.
> In defense of mypy and typing in general, there's a more idiomatic
approach to this problem by defining a class as a Generic (​docs for
Generics here).
First: Not criticising you here! :)
This thought seems to me to have lost the wood for the trees. Translated
it reads: Add a lot of noise to your code in order to avoid adding a lot
of (more boilerplate) noise to your code. Typing was meant to be an
optional add-on to Python. I can't (yet) see that it's not an issue with
mypy that we have to add this stuff when (surely) `cls` could be inferred
as the default for `__class_getitem__`. (Truly this baffles me.)
Don't suppose you know the best place to make this kind of point to the
mypy maintainers do you? (I'll have to look around.)
I'm going to have to close this as needsinfo. I can't see that accepting
this here is compatible with the previous Technical Board decision. I
think we need to go back to the DevelopersMailingList to ask for review.
--
Ticket URL: <https://code.djangoproject.com/ticket/32156#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/070.2ead6d128766fe360ce97443919100ac%40djangoproject.com.