FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Confusing __class__ for instance of non-generic class that subclasses generic class · Issue #129 · python/typing · GitHub

/ typing Public

Confusing __class__ for instance of non-generic class that subclasses generic class #129

Description

The following program prints __main__.A[int] even though A is not generic. I'd expect it to print something like <class '__main__.A'>.

from typing import Iterator

class A(Iterator[int]):
    def __next__(self): pass

print(A().__class__)

Also, this does not generate an exception, even though A is not generic:

def f(x: A[int]) -> None: pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL