-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
None is accepted as a type but it behaves erratically #299
Comments
After we add Optional checking, maybe we can make |
Fixed by #3024. |
In from typing import List
from typing import Optional
from typing import Union
from typing import Generic
from typing import TypeVar
a: List[None] = [None]
a.append(None)
b: List[Optional[None]] = [None]
b.append(None)
c: List[Union[None]] = [None]
c.append(None)
T = TypeVar('T')
class Foo(Generic[T]):
def __init__(self, value: T) -> None:
return
def append(self, value: T) -> None:
return
f: Foo[None] = Foo(None)
f.append(None) Then
So it seems that using |
@orenbenkiki 0.501 is pretty old. Have you a tried the latest versions? it works for me on git master. |
Ah, it works in version 0.550. Thanks. Version 0.501 was released in March this year, if that makes it "old.".. it is great to see |
Yeah, 0.501 is already old in "mypy years" :-) |
The following fragment generates a confusing error message:
The text was updated successfully, but these errors were encountered: