#32156: Add __class_getitem__ to support runtime type parameters for more 
classes
-------------------------------------+-------------------------------------
               Reporter:  Brady      |          Owner:  nobody
  Kieffer                            |
                   Type:  New        |         Status:  new
  feature                            |
              Component:  Utilities  |        Version:  2.2
               Severity:  Normal     |       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          |
-------------------------------------+-------------------------------------
 We use the library django-stubs pretty extensively. Recently, they
 introduced a patch treating more types as Generics. To handle this on our
 side we either need to work `mypy` in a decently annoying manner. Much
 like issue #31223, I propose we add a `__class_getitem__` to the following
 classes:

 * BaseModelAdmin
 * Options
 * Lookup
 * Field

 Much like before `__class_getitem__` would purely be for `mypy` type
 checks and a no-op for the django runtime. Only other thing to note, for
 us the most important class to update would be `BaseModelAdmin`, so if
 there are reasons not to add `__class_getitem__` to the other classes, I
 can forgo that change.

 Related patch - Fixed #31223: https://github.com/django/django/pull/12405
 django-stubs: https://github.com/typeddjango/django-stubs

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32156>
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/055.eb574d22d06f822104b2d2b38d8e5d68%40djangoproject.com.

Reply via email to