Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Parameterized types of generic classes sometimes shared between class instances #590

Copy link
Copy link
@jakebailey

Description

@jakebailey
Issue body actions

In the below, both intval and strval come to be int, even though hovering over boxedint and boxedstr show Box[int] and Box[str] respectively.

from typing import TypeVar, Generic

_T = TypeVar("_T")

class Box(Generic[_T]):
    def __init__(self, v: _T):
        self.v = v
    
    def get(self) -> _T:
        return self.v


boxedint = Box(1234)
intval = boxedint.get()

boxedstr = Box("foo")
strval = boxedstr.get()
Reactions are currently unavailable

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.