{"action":"created","issue":{"url":"https://api.github.com/repos/python/mypy/issues/1237","repository_url":"https://api.github.com/repos/python/mypy","labels_url":"https://api.github.com/repos/python/mypy/issues/1237/labels{/name}","comments_url":"https://api.github.com/repos/python/mypy/issues/1237/comments","events_url":"https://api.github.com/repos/python/mypy/issues/1237/events","html_url":"https://github.com/python/mypy/issues/1237","id":136162181,"number":1237,"title":"Why is \"incompatible with supertype\" an error?","user":{"login":"philthompson10","id":17459808,"avatar_url":"https://avatars.githubusercontent.com/u/17459808?v=3","gravatar_id":"","url":"https://api.github.com/users/philthompson10","html_url":"https://github.com/philthompson10","followers_url":"https://api.github.com/users/philthompson10/followers","following_url":"https://api.github.com/users/philthompson10/following{/other_user}","gists_url":"https://api.github.com/users/philthompson10/gists{/gist_id}","starred_url":"https://api.github.com/users/philthompson10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philthompson10/subscriptions","organizations_url":"https://api.github.com/users/philthompson10/orgs","repos_url":"https://api.github.com/users/philthompson10/repos","events_url":"https://api.github.com/users/philthompson10/events{/privacy}","received_events_url":"https://api.github.com/users/philthompson10/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/python/mypy/labels/enhancement%20proposal","name":"enhancement proposal","color":"bfdadc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2016-02-24T19:27:43Z","updated_at":"2016-02-27T08:47:24Z","closed_at":null,"body":"Why does mypy consider...\r\n```\r\nclass Foo:\r\n    def factory(self) -> str:\r\n        return 'Hello'\r\n\r\nclass Bar(Foo):\r\n    def factory(self) -> int:\r\n        return 10\r\n```\r\nto be an error? While it may be poor design, it isn't wrong.\r\n\r\nThanks,\r\nPhil"},"comment":{"url":"https://api.github.com/repos/python/mypy/issues/comments/189607418","html_url":"https://github.com/python/mypy/issues/1237#issuecomment-189607418","issue_url":"https://api.github.com/repos/python/mypy/issues/1237","id":189607418,"user":{"login":"philthompson10","id":17459808,"avatar_url":"https://avatars.githubusercontent.com/u/17459808?v=3","gravatar_id":"","url":"https://api.github.com/users/philthompson10","html_url":"https://github.com/philthompson10","followers_url":"https://api.github.com/users/philthompson10/followers","following_url":"https://api.github.com/users/philthompson10/following{/other_user}","gists_url":"https://api.github.com/users/philthompson10/gists{/gist_id}","starred_url":"https://api.github.com/users/philthompson10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philthompson10/subscriptions","organizations_url":"https://api.github.com/users/philthompson10/orgs","repos_url":"https://api.github.com/users/philthompson10/repos","events_url":"https://api.github.com/users/philthompson10/events{/privacy}","received_events_url":"https://api.github.com/users/philthompson10/received_events","type":"User","site_admin":false},"created_at":"2016-02-27T08:47:24Z","updated_at":"2016-02-27T08:47:24Z","body":"On 27 Feb 2016, at 12:39 am, David Fisher <notifications@github.com> wrote:\n> \n> From reading the PEP I don't get any feeling that it's only intended to cover a conforming sub-set of Python code. I read it and think here is a specification for describing any Python API in a standard way.\n> \n> It's not possible to describe all possible valid Python API's statically, except perhaps with an exceedingly complex type system. For example, you could have some function:\n> \n> def f(x: int) -> ???\n> :\n>   \n> if x < 0: return 0\n> \n>   \n> else: return \"hello\"\n> and call it like this:\n> \n> print(f(5) + \" world\")\n> This program will execute without errors, but the only way to type it properly is with dependent types, which are rather difficult to understand/work with.\n\nUnderstood - if the context is restricted to type checking - but there may be other contexts (eg. generating boilerplate documentation) where ??? is Union[int, str] is a useful piece of information."}}