-
Notifications
You must be signed in to change notification settings - Fork 284
Open
Labels
topic: featureDiscussions about new features for Python's type annotationsDiscussions about new features for Python's type annotations
Description
This is the same issue as #1835, which was closed -- the given reason was that object can be used instead of Unknown. However, this is not the case. Consider:
class Foo(tp.Generic[T]):
def bar(self, x: T) -> T:
...
def baz(...):
...
I want a type that represents "Foo with unknown T", which I can call baz on but not bar.
foo: Foo[Unknown] = ...
foo.bar(1) # type error, int cannot be assigned to Unknown
foo.baz() # works fine because no T is needed
This doesn't work if I use object:
foo: Foo[object] = ...
foo.bar(1) # typechecks because int is a subtype of object
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
topic: featureDiscussions about new features for Python's type annotationsDiscussions about new features for Python's type annotations