# Spec change: Do not require an error for a generic class attribute

**URL:** <https://discuss.python.org/t/spec-change-do-not-require-an-error-for-a-generic-class-attribute/108456>\
**Category:** Typing\
**Created:** [August 7, 2026, 4:16am UTC](https://discuss.python.org/t/spec-change-do-not-require-an-error-for-a-generic-class-attribute/108456 "2026-08-07T04:16:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jelle](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/jelle/32/1049_2.png) [@Jelle](https://discuss.python.org/u/Jelle)\
**Post date:** [August 7, 2026, 4:16am UTC](https://discuss.python.org/t/spec-change-do-not-require-an-error-for-a-generic-class-attribute/108456/1 "2026-08-07T04:16:26Z")

</div>

The conformance suite currently requires an error for this code:

```python
from typing import Any, TypeVar, Generic, assert_type

T = TypeVar("T")

class Node(Generic[T]):
    label: T
    def __init__ (self, label: T | None = None) -> None:
        if label is not None:
            self.label = label

n1: Node[int] = Node()
type(n1).label # E

```

While that error is correct in this specific case, it’s difficult to justify it in general: the attribute may be defined on a child class, for example. Currently mypy and ty do not error on this code. Pyright also [considered](https://github.com/microsoft/pyright/issues/10304) changing this but backed out the change to maintain compliance with the spec.

@erictraut opened a [PR](https://github.com/python/typing/pull/2008) last year to change the spec here, but it slipped through the cracks. I looked at it again today and feel we should change the conformance suite here; I’m posting to Discuss to fulfill the requirements in the change procedure.

---

<div class="post-metadata">

**Author:** ![rchen152](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/rchen152/32/16955_2.png) [@rchen152](https://discuss.python.org/u/rchen152)\
**Post date:** [August 7, 2026, 9:08am UTC](https://discuss.python.org/t/spec-change-do-not-require-an-error-for-a-generic-class-attribute/108456/2 "2026-08-07T09:08:58Z")

</div>

I’m in favor of this proposed change. Looking through previous discussions ( [Accessing generic attribute on `type[X]`](https://discuss.python.org/t/accessing-generic-attribute-on-type-x/92662) , [Is it ambiguous to access a generic instance variable on a class which is bound to a specific type? · microsoft/pyright · Discussion #10303 · GitHub](https://github.com/microsoft/pyright/discussions/10303) ), the motivating example for removing the error on `type(n1)` is something like this:

```python
class Node[T]:
    label: T

class IntNode(Node[int]):
    label: int

n1: IntNode = IntNode()
type(n1).label # mypy, pyrefly, pyright, ty, and zuban all allow this

def f(n1: Node):
    return type(n1).label # but this is an error?
f(n1)

```

The error doesn’t make much sense here, so not requiring it seems very reasonable.
