{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/PTVS/issues/82","labels_url":"https://api.github.com/repos/Microsoft/PTVS/issues/82/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/PTVS/issues/82/comments","events_url":"https://api.github.com/repos/Microsoft/PTVS/issues/82/events","html_url":"https://github.com/Microsoft/PTVS/issues/82","id":73092830,"number":82,"title":"Use type hints in Python 3.x to infer variable types if possible","user":{"login":"zooba","id":1693688,"avatar_url":"https://avatars.githubusercontent.com/u/1693688?v=3","gravatar_id":"","url":"https://api.github.com/users/zooba","html_url":"https://github.com/zooba","followers_url":"https://api.github.com/users/zooba/followers","following_url":"https://api.github.com/users/zooba/following{/other_user}","gists_url":"https://api.github.com/users/zooba/gists{/gist_id}","starred_url":"https://api.github.com/users/zooba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zooba/subscriptions","organizations_url":"https://api.github.com/users/zooba/orgs","repos_url":"https://api.github.com/users/zooba/repos","events_url":"https://api.github.com/users/zooba/events{/privacy}","received_events_url":"https://api.github.com/users/zooba/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/PTVS/labels/Code%20Intelligence","name":"Code Intelligence","color":"fef2c0"},{"url":"https://api.github.com/repos/Microsoft/PTVS/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-05-04T18:32:07Z","updated_at":"2015-08-03T18:48:30Z","closed_at":null,"body":"Even though Python ignores type hints at runtime and they can be pretty much any expression, we should use them to infer variable types in a function if we possibly can.\r\n\r\nSee [PEP 484](https://www.python.org/dev/peps/pep-0484/)\r\n\r\n(Migrated from https://pytools.codeplex.com/workitem/394)\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/PTVS/issues/comments/127368122","html_url":"https://github.com/Microsoft/PTVS/issues/82#issuecomment-127368122","issue_url":"https://api.github.com/repos/Microsoft/PTVS/issues/82","id":127368122,"user":{"login":"zooba","id":1693688,"avatar_url":"https://avatars.githubusercontent.com/u/1693688?v=3","gravatar_id":"","url":"https://api.github.com/users/zooba","html_url":"https://github.com/zooba","followers_url":"https://api.github.com/users/zooba/followers","following_url":"https://api.github.com/users/zooba/following{/other_user}","gists_url":"https://api.github.com/users/zooba/gists{/gist_id}","starred_url":"https://api.github.com/users/zooba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zooba/subscriptions","organizations_url":"https://api.github.com/users/zooba/orgs","repos_url":"https://api.github.com/users/zooba/repos","events_url":"https://api.github.com/users/zooba/events{/privacy}","received_events_url":"https://api.github.com/users/zooba/received_events","type":"User","site_admin":false},"created_at":"2015-08-03T18:48:30Z","updated_at":"2015-08-03T18:48:30Z","body":"@theonewolf I don't think we preserve enough information for it to be generic, unfortunately - dictionaries in particular only keep a very limited amount of precise key-value mappings based on the key **value** before switching to using the key's **type** (probably `str`, as opposed to `\"x\"`).\r\n\r\nThe best approach right now is to assert at the start of your function (we should support `isinstance(x, A) and isinstance(y, B) and ...`), or use `if False` and assignments (which allows you a choice of whether to include the types passed in or exclude them as you wish)."}}