# Typing

**URL:** https://discuss.python.org/c/typing/32.md

[Latest](https://discuss.python.org/latest.md) · [Categories](https://discuss.python.org/categories.md) · [Tags](https://discuss.python.org/tags.md)

---

## [About the Typing category](https://discuss.python.org/t/about-the-typing-category/34155)

<div class="topic-metadata">

**Author:** [@brettcannon](https://discuss.python.org/u/brettcannon)\
**Replies:** 2\
**Last updated:** [October 17, 2023, 10:24am UTC](https://discuss.python.org/t/about-the-typing-category/34155 "2023-10-17T10:24:11Z")

</div>

Discussions involving typing in Python. Previously this was the typing-sig mailing list.

---

## [Syntax to declare implementation of structural types without inheritance](https://discuss.python.org/t/syntax-to-declare-implementation-of-structural-types-without-inheritance/110143)

<div class="topic-metadata">

**Author:** [@galbiatig](https://discuss.python.org/u/galbiatig)\
**Replies:** 14\
**Last updated:** [November 17, 2026, 4:45am UTC](https://discuss.python.org/t/syntax-to-declare-implementation-of-structural-types-without-inheritance/110143 "2026-11-17T04:45:12Z")

</div>

I’d like feedback on a potential typing syntax idea to address some challenges I’ve seen around Protocol. I did try to search for a similar idea here, but didn’t locate one. (It wouldn’t surprise me if there was one, tho…

---

## [\`collections.Mapping\`s: \`.get(x)\` v.s. \`.\_\_getitem\_\_(x)\`](https://discuss.python.org/t/collections-mapping-s-get-x-v-s-getitem-x/110126)

<div class="topic-metadata">

**Author:** [@anabelle2001](https://discuss.python.org/u/anabelle2001)\
**Replies:** 5\
**Last updated:** [November 16, 2026, 10:04pm UTC](https://discuss.python.org/t/collections-mapping-s-get-x-v-s-getitem-x/110126 "2026-11-16T22:04:23Z")

</div>

Consider the following code: from typing import assert\_type, Mapping def my\_function(some\_map: Mapping\[str, object\]): match some\_map: case {"count": int()}: from\_get = some\_map.get('count') …

---

## [Lower Bounds / Contravariant Type](https://discuss.python.org/t/lower-bounds-contravariant-type/110095)

<div class="topic-metadata">

**Author:** [@isaacbell](https://discuss.python.org/u/isaacbell)\
**Replies:** 7\
**Last updated:** [November 15, 2026, 4:42am UTC](https://discuss.python.org/t/lower-bounds-contravariant-type/110095 "2026-11-15T04:42:19Z")

</div>

I couldn’t find any discussion on here about this, so was wondering about the implementation of lower bounds. Take for example: class A: ... class B(A): ... \>\>\> B.\_\_mro\_\_ (B, A, object) The typing of B.\_\_mro\_\_ accord…

---

## [Proposal: specialize generic subclass from inherited \`\_\_init\_\_\`'s \`self\` annotation](https://discuss.python.org/t/proposal-specialize-generic-subclass-from-inherited-init-s-self-annotation/109979)

<div class="topic-metadata">

**Author:** [@crypt0lith](https://discuss.python.org/u/crypt0lith)\
**Replies:** 0\
**Last updated:** [November 9, 2026, 5:55pm UTC](https://discuss.python.org/t/proposal-specialize-generic-subclass-from-inherited-init-s-self-annotation/109979 "2026-11-09T17:55:14Z")

</div>

The constructors chapter lets \_\_init\_\_ annotate self “with a type that influences the resulting type of the constructor call”. Its examples and the conformance tests all annotate self with the class that declares the \_\_i…

---

## [Support Function With Multiple Generic Parameters Same Type](https://discuss.python.org/t/support-function-with-multiple-generic-parameters-same-type/57931)

<div class="topic-metadata">

**Author:** [@saulshanabrook](https://discuss.python.org/u/saulshanabrook)\
**Replies:** 19\
**Last updated:** [November 7, 2026, 4:57pm UTC](https://discuss.python.org/t/support-function-with-multiple-generic-parameters-same-type/57931 "2026-11-07T16:57:52Z")

</div>

I would like to be able to type a function that has multiple parameters, with the same generic variable, that only checks if the later parameters are compatible with the first. Proposal I propose by adding a bind\_first …

---

## [Supporting Descriptors that override the Implicit Receiver Parameter](https://discuss.python.org/t/supporting-descriptors-that-override-the-implicit-receiver-parameter/109823)

<div class="topic-metadata">

**Author:** [@isaacbell](https://discuss.python.org/u/isaacbell)\
**Replies:** 2\
**Last updated:** [November 5, 2026, 8:47pm UTC](https://discuss.python.org/t/supporting-descriptors-that-override-the-implicit-receiver-parameter/109823 "2026-11-05T20:47:15Z")

</div>

Apologies in advance if this sounds more like a bug report than a discussion, however, I was wondering if it would be possible for static type checkers to support descriptors that modify the type passed to the first para…

---

## [Proposal: Store Python typing survey data in \`python/typing\` github repo](https://discuss.python.org/t/proposal-store-python-typing-survey-data-in-python-typing-github-repo/109738)

<div class="topic-metadata">

**Author:** [@grievejia](https://discuss.python.org/u/grievejia)\
**Replies:** 6\
**Last updated:** [October 29, 2026, 6:55pm UTC](https://discuss.python.org/t/proposal-store-python-typing-survey-data-in-python-typing-github-repo/109738 "2026-10-29T18:55:03Z")

</div>

I’d like to propose adding the published 2025 and 2026 Python typing survey data to python/typing, giving it a permanent home maintained by the community. Sebastian suggested this during today’s typing meetup. The surve…

---

## [Typing Meetup: Call for topics in October or November](https://discuss.python.org/t/typing-meetup-call-for-topics-in-october-or-november/109163)

<div class="topic-metadata">

**Author:** [@stroxler](https://discuss.python.org/u/stroxler)\
**Replies:** 4\
**Last updated:** [October 28, 2026, 7:12pm UTC](https://discuss.python.org/t/typing-meetup-call-for-topics-in-october-or-november/109163 "2026-10-28T19:12:00Z")

</div>

Hi all! I’d like to hold another zoom typing meetup in October or November if there are topics folks would like to discuss. If you’re interested in presenting, please reply in this thread. Cc @rchen152 , @Jelle , @davi…

---

## [Plain annotations for descriptor-backed fields (ORMs, dataclass\_transform)](https://discuss.python.org/t/plain-annotations-for-descriptor-backed-fields-orms-dataclass-transform/109427)

<div class="topic-metadata">

**Author:** [@bmo](https://discuss.python.org/u/bmo)\
**Replies:** 4\
**Last updated:** [October 26, 2026, 5:37pm UTC](https://discuss.python.org/t/plain-annotations-for-descriptor-backed-fields-orms-dataclass-transform/109427 "2026-10-26T17:37:57Z")

</div>

Is there a way for a library to declare that plain field annotations on its models stand for descriptor-backed attributes, so that class access gets the descriptor’s type? I am looking for something checkers can interpre…

---

## [A ternary operator for typed Python](https://discuss.python.org/t/a-ternary-operator-for-typed-python/102617)

<div class="topic-metadata">

**Author:** [@smcjones](https://discuss.python.org/u/smcjones)\
**Replies:** 4\
**Last updated:** [October 15, 2026, 7:02pm UTC](https://discuss.python.org/t/a-ternary-operator-for-typed-python/102617 "2026-10-15T19:02:21Z")

</div>

Hello, this is my first post here, so I’m sorry if this has already been discussed. I don’t see any PEPs related to this and my search of this forum and GitHub came back empty. Proposal would be to add the following typ…

---

## [Typing overloaded function signature with non-optional keyword-only argument](https://discuss.python.org/t/typing-overloaded-function-signature-with-non-optional-keyword-only-argument/109489)

<div class="topic-metadata">

**Author:** [@CarrotManMatt](https://discuss.python.org/u/CarrotManMatt)\
**Replies:** 3\
**Last updated:** [October 15, 2026, 2:29pm UTC](https://discuss.python.org/t/typing-overloaded-function-signature-with-non-optional-keyword-only-argument/109489 "2026-10-15T14:29:29Z")

</div>

Hiya, mypy has been telling me that the first overloaded function signature here is not covered by the implementation. Am I missing something, as I believe it is. Is this just a current shortcoming of the type-checking t…

---

## [Type hint ignore all references to a particular variable?](https://discuss.python.org/t/type-hint-ignore-all-references-to-a-particular-variable/109378)

<div class="topic-metadata">

**Author:** [@NickC](https://discuss.python.org/u/NickC)\
**Replies:** 39\
**Last updated:** [October 10, 2026, 1:33am UTC](https://discuss.python.org/t/type-hint-ignore-all-references-to-a-particular-variable/109378 "2026-10-10T01:33:11Z")

</div>

Is there any way I can tell the PyCharm Type-checker to ignore all warnings for a particular variable? I know I can ignore each line but as this variable is used all over the project it would be good to find some way to…

---

## [Amend PEP 586 to make \`enum\` values subtypes of \`Literal\`](https://discuss.python.org/t/amend-pep-586-to-make-enum-values-subtypes-of-literal/59456)

<div class="topic-metadata">

**Author:** [@randolf-scholz](https://discuss.python.org/u/randolf-scholz)\
**Replies:** 14\
**Last updated:** [October 9, 2026, 2:09pm UTC](https://discuss.python.org/t/amend-pep-586-to-make-enum-values-subtypes-of-literal/59456 "2026-10-09T14:09:29Z")

</div>

Inspired by this highly upvoted issue: Literal of enum values · Issue #781 · python/typing · GitHub, I propose that enum values, if they are defined literally and are instances of the type of the literal (So this woul…

---

## [Improving overloads with intersections](https://discuss.python.org/t/improving-overloads-with-intersections/109322)

<div class="topic-metadata">

**Author:** [@mikeshardmind](https://discuss.python.org/u/mikeshardmind)\
**Replies:** 9\
**Last updated:** [October 7, 2026, 11:45pm UTC](https://discuss.python.org/t/improving-overloads-with-intersections/109322 "2026-10-07T23:45:46Z")

</div>

(hopefully last lead up discussion topic on intersections needed) Right now, overload resolution rules allow producing mostly good results, but to get those, there’s a significant amount of verbosity. I expect this to g…

---

## [Notes on splitting unions in subtype checks](https://discuss.python.org/t/notes-on-splitting-unions-in-subtype-checks/109329)

<div class="topic-metadata">

**Author:** [@grievejia](https://discuss.python.org/u/grievejia)\
**Replies:** 7\
**Last updated:** [October 3, 2026, 5:45am UTC](https://discuss.python.org/t/notes-on-splitting-unions-in-subtype-checks/109329 "2026-10-03T05:45:29Z")

</div>

I’ve been looking at how type checkers solve subtype constraints lately. This post describes an interesting case that does not seem to be widely discussed, and may be useful to other type checker authors. Throughout the…

---

## [Pulse check on Intersections draft work](https://discuss.python.org/t/pulse-check-on-intersections-draft-work/109087)

<div class="topic-metadata">

**Author:** [@mikeshardmind](https://discuss.python.org/u/mikeshardmind)\
**Replies:** 37\
**Last updated:** [October 2, 2026, 2:38pm UTC](https://discuss.python.org/t/pulse-check-on-intersections-draft-work/109087 "2026-10-02T14:38:53Z")

</div>

I’m nearing readiness to start working on finding a typechecker to work with on a reference implementation + a PEP proposal. I’d like to check with the community to make sure the behavior of 2 specific cases is somethin…

---

## [2026 Python Type System and Tooling Survey is out!](https://discuss.python.org/t/2026-python-type-system-and-tooling-survey-is-out/108426)

<div class="topic-metadata">

**Author:** [@grievejia](https://discuss.python.org/u/grievejia)\
**Replies:** 6\
**Last updated:** [October 2, 2026, 2:01am UTC](https://discuss.python.org/t/2026-python-type-system-and-tooling-survey-is-out/108426 "2026-10-02T02:01:31Z")

</div>

The 2026 Python Type System and Tooling Survey is out! Take the survey here: Python Type System and Tooling Survey 2026 (or scan the QR code attached at the end). I also want to say a huge thank-you to the folks who co…

---

## [Why does \`ClassVar\` disallow type variables?](https://discuss.python.org/t/why-does-classvar-disallow-type-variables/109288)

<div class="topic-metadata">

**Author:** [@MajorDallas](https://discuss.python.org/u/MajorDallas)\
**Replies:** 2\
**Last updated:** [September 30, 2026, 10:07pm UTC](https://discuss.python.org/t/why-does-classvar-disallow-type-variables/109288 "2026-09-30T22:07:26Z")

</div>

PEP-526 states Note that a ClassVar parameter cannot include any type variables, regardless of the level of nesting: ClassVar\[T\] and ClassVar\[List\[Set\[T\]\]\] are both invalid if T is a type variable. I’m curious why th…

---

## [Should non-generic classes with \`\_\_class\_getitem\_\_\` be subscriptable in a type expression?](https://discuss.python.org/t/should-non-generic-classes-with-class-getitem-be-subscriptable-in-a-type-expression/108666)

<div class="topic-metadata">

**Author:** [@carljm](https://discuss.python.org/u/carljm)\
**Replies:** 40\
**Last updated:** [September 28, 2026, 4:20pm UTC](https://discuss.python.org/t/should-non-generic-classes-with-class-getitem-be-subscriptable-in-a-type-expression/108666 "2026-09-28T16:20:21Z")

</div>

The AstroPy library documents a suggested pattern to type-annotate using an expression like Quantity\[u.km\]. Quantity is not a generic class, but it implements \_\_class\_getitem\_\_ to return Annotated\[Quantity, u.km\] – effec…

---

## [Make \_\_replace\_\_ stop interfering with variance inference](https://discuss.python.org/t/make-replace-stop-interfering-with-variance-inference/96092)

<div class="topic-metadata">

**Author:** [@NeilGirdhar](https://discuss.python.org/u/NeilGirdhar)\
**Replies:** 44\
**Last updated:** [September 27, 2026, 10:07pm UTC](https://discuss.python.org/t/make-replace-stop-interfering-with-variance-inference/96092 "2026-09-27T22:07:08Z")

</div>

Consider: from dataclasses import dataclass from typing import Generic, TypeVar, override if False: # Switch to True is a type error. @dataclass(frozen=True) class C\[T\]: x: T # T is inferred to be in…

---

## [Draft PEP: More Expressive Type Expressions](https://discuss.python.org/t/draft-pep-more-expressive-type-expressions/108856)

<div class="topic-metadata">

**Author:** [@ImogenBits](https://discuss.python.org/u/ImogenBits)\
**Replies:** 13\
**Last updated:** [September 21, 2026, 10:00pm UTC](https://discuss.python.org/t/draft-pep-more-expressive-type-expressions/108856 "2026-09-21T22:00:06Z")

</div>

This is a continuation of my previous post on this topic. I’ve decided to make this a new thread since the ideas have been refocused a lot since then and my goal now is to essentially make a new run down of the problem a…

---

## [Conditional imports in stub files](https://discuss.python.org/t/conditional-imports-in-stub-files/50326)

<div class="topic-metadata">

**Author:** [@srittau](https://discuss.python.org/u/srittau)\
**Replies:** 6\
**Last updated:** [September 19, 2026, 1:45pm UTC](https://discuss.python.org/t/conditional-imports-in-stub-files/50326 "2026-09-19T13:45:31Z")

</div>

This came up during the transition from types-Pillow to inline annotations in Pillow. See Depend on Pillow instead of types-Pillow by srittau · Pull Request #11720 · python/typeshed · GitHub. The Package python-xlib has…

---

## [Suggestion: add a typing.safe\_cast() function, which just does assert isinstance(x, T)](https://discuss.python.org/t/suggestion-add-a-typing-safe-cast-function-which-just-does-assert-isinstance-x-t/109081)

<div class="topic-metadata">

**Author:** [@noamraph](https://discuss.python.org/u/noamraph)\
**Replies:** 9\
**Last updated:** [September 17, 2026, 2:38pm UTC](https://discuss.python.org/t/suggestion-add-a-typing-safe-cast-function-which-just-does-assert-isinstance-x-t/109081 "2026-09-17T14:38:55Z")

</div>

I’m regularly defining this function, which helps make my code shorter and easier to read. I think it may be a good idea to add something like this to the typing module: def safe\_cast\[T\](t: type\[T\], x: object) -\> T: …

---

## [ParamSpec on overloaded & generic functions](https://discuss.python.org/t/paramspec-on-overloaded-generic-functions/109091)

<div class="topic-metadata">

**Author:** [@decorator-factory](https://discuss.python.org/u/decorator-factory)\
**Replies:** 0\
**Last updated:** [September 17, 2026, 3:17am UTC](https://discuss.python.org/t/paramspec-on-overloaded-generic-functions/109091 "2026-09-17T03:17:29Z")

</div>

Some thoughts on how ParamSpec interacts with generic and overloaded functions. Generic functions First example, with a generic function (works in mypy, pyright, ty, pyrefly, but not zuban): from collections.abc import…

---

## [\_ProtocolMeta: why? Can it be removed?](https://discuss.python.org/t/protocolmeta-why-can-it-be-removed/108813)

<div class="topic-metadata">

**Author:** [@jacopoabramo](https://discuss.python.org/u/jacopoabramo)\
**Replies:** 4\
**Last updated:** [September 16, 2026, 9:17am UTC](https://discuss.python.org/t/protocolmeta-why-can-it-be-removed/108813 "2026-09-16T09:17:21Z")

</div>

Having a look at typing.Protocol, this seems to depend on a metatype \_ProtocolMeta. From the main branch of the CPython repository, this is what it’s reported: class \_ProtocolMeta(ABCMeta): # This metaclass is some…

---

## [Idea: Simpler and More Expressive Type Annotations](https://discuss.python.org/t/idea-simpler-and-more-expressive-type-annotations/104730)

<div class="topic-metadata">

**Author:** [@ImogenBits](https://discuss.python.org/u/ImogenBits)\
**Replies:** 84\
**Last updated:** [September 2, 2026, 3:21pm UTC](https://discuss.python.org/t/idea-simpler-and-more-expressive-type-annotations/104730 "2026-09-02T15:21:07Z")

</div>

Something that comes up occasionally is that type annotations are somewhat verbose and limited in functionality. For example, the recent discussion around an inline typed dict syntax is heavily constrained by the fact th…

---

## [Class \`date\` is unsafe in typed Python](https://discuss.python.org/t/class-date-is-unsafe-in-typed-python/107590)

<div class="topic-metadata">

**Author:** [@maciek](https://discuss.python.org/u/maciek)\
**Replies:** 1\
**Last updated:** [September 2, 2026, 9:20am UTC](https://discuss.python.org/t/class-date-is-unsafe-in-typed-python/107590 "2026-09-02T09:20:30Z")

</div>

Hello, I’d like to discuss adding an optional mypy feature that rejects unsafe subtype-based usage between date and datetime. Currently the following code passes type checking but raises TypeError at runtime: from dat…

---

## [Permitting more precise inferred types from ambiguous overloads](https://discuss.python.org/t/permitting-more-precise-inferred-types-from-ambiguous-overloads/108776)

<div class="topic-metadata">

**Author:** [@carljm](https://discuss.python.org/u/carljm)\
**Replies:** 19\
**Last updated:** [September 1, 2026, 10:30pm UTC](https://discuss.python.org/t/permitting-more-precise-inferred-types-from-ambiguous-overloads/108776 "2026-09-01T22:30:31Z")

</div>

The typing spec and conformance suite currently require that if overload resolution is ambiguous due to gradual argument types, the return type must be inferred as Any. This is motivated by maintaining graduality of inp…

---

## [Proposal: \`typing.no\_discard\`, a decorator to indicate that the return value should not be discarded](https://discuss.python.org/t/proposal-typing-no-discard-a-decorator-to-indicate-that-the-return-value-should-not-be-discarded/33138)

<div class="topic-metadata">

**Author:** [@kwsp](https://discuss.python.org/u/kwsp)\
**Replies:** 54\
**Last updated:** [August 30, 2026, 6:20am UTC](https://discuss.python.org/t/proposal-typing-no-discard-a-decorator-to-indicate-that-the-return-value-should-not-be-discarded/33138 "2026-08-30T06:20:14Z")

</div>

Moving this discussion in a new direction In Python, there is no way to enforce a return value from a function/method is used. This is especially useful for functions and methods that are pure (i.e. the function has no …

[Next page](https://discuss.python.org/c/typing/32.md?page=1)
