Last active
January 10, 2019 08:49
-
-
Save kezabelle/89dc9ec59e63a9772c5ad2a2252cee8a to your computer and use it in GitHub Desktop.
bleh, typing is pain.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Tuple, Dict, List | |
| class M(object): | |
| def __init__(self, x: int): | |
| self.id = x | |
| Models = List[M] | |
| def problem() -> None: | |
| seen = {} # type: Dict[int,Models] | |
| for x in [1, 2]: | |
| result = list_of_other_items(x) | |
| seen[x] = result[0] # error: Incompatible types in assignment (expression has type "M", target has type "List[M]") | |
| return None | |
| def list_of_other_items(i: int) -> Models: | |
| return [M(2)] |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change the definition of
Mto:and suddenly no errors appear :(