{"action":"created","issue":{"url":"https://api.github.com/repos/python/typing/issues/300","repository_url":"https://api.github.com/repos/python/typing","labels_url":"https://api.github.com/repos/python/typing/issues/300/labels{/name}","comments_url":"https://api.github.com/repos/python/typing/issues/300/comments","events_url":"https://api.github.com/repos/python/typing/issues/300/events","html_url":"https://github.com/python/typing/issues/300","id":183263494,"number":300,"title":"Add an exception to PEP 484 about meaning of generics without arguments","user":{"login":"ilevkivskyi","id":12005495,"avatar_url":"https://avatars.githubusercontent.com/u/12005495?v=3","gravatar_id":"","url":"https://api.github.com/users/ilevkivskyi","html_url":"https://github.com/ilevkivskyi","followers_url":"https://api.github.com/users/ilevkivskyi/followers","following_url":"https://api.github.com/users/ilevkivskyi/following{/other_user}","gists_url":"https://api.github.com/users/ilevkivskyi/gists{/gist_id}","starred_url":"https://api.github.com/users/ilevkivskyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilevkivskyi/subscriptions","organizations_url":"https://api.github.com/users/ilevkivskyi/orgs","repos_url":"https://api.github.com/users/ilevkivskyi/repos","events_url":"https://api.github.com/users/ilevkivskyi/events{/privacy}","received_events_url":"https://api.github.com/users/ilevkivskyi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-16T12:02:21Z","updated_at":"2016-10-16T21:34:09Z","closed_at":null,"body":"Currently, PEP 484 says that bare ``List`` is equivalent to ``List[Any]``, etc. However, I think that this rule should be changed for type aliases like ``re.Match``, ``re.Pattern``, etc. For such cases bare ``re.Match`` should be equivalent to ``re.Match[AnyStr]``.\r\n\r\n@gvanrossum If you agree, then you can assign this issue to me."},"comment":{"url":"https://api.github.com/repos/python/typing/issues/comments/254076655","html_url":"https://github.com/python/typing/issues/300#issuecomment-254076655","issue_url":"https://api.github.com/repos/python/typing/issues/300","id":254076655,"user":{"login":"JukkaL","id":1107911,"avatar_url":"https://avatars.githubusercontent.com/u/1107911?v=3","gravatar_id":"","url":"https://api.github.com/users/JukkaL","html_url":"https://github.com/JukkaL","followers_url":"https://api.github.com/users/JukkaL/followers","following_url":"https://api.github.com/users/JukkaL/following{/other_user}","gists_url":"https://api.github.com/users/JukkaL/gists{/gist_id}","starred_url":"https://api.github.com/users/JukkaL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JukkaL/subscriptions","organizations_url":"https://api.github.com/users/JukkaL/orgs","repos_url":"https://api.github.com/users/JukkaL/repos","events_url":"https://api.github.com/users/JukkaL/events{/privacy}","received_events_url":"https://api.github.com/users/JukkaL/received_events","type":"User","site_admin":false},"created_at":"2016-10-16T21:34:09Z","updated_at":"2016-10-16T21:34:09Z","body":"I agree with Guido that `AnyStr` is not a good default. \r\n\r\nUsing some sort of an upper bound is not a good idea either, because it would result in wider/more restrictive types and may require code to use `isinstance` tests to do anything useful with values of such types, which is the opposite of what `Any` does, which is to make it more flexible and never require any type checks. The property that `Any` behaves kind of like both the supertype and subtype of everything is important. I can give examples if you aren't convinced :-)\r\n\r\nIf we had the concept of an 'unsafe' union, we could use `Match[UnsafeUnion[str, bytes]]` as the meaning of `Match`. Unsafe unions have been discussed before, but the idea is that a type checker would allow an operation if it's supported by *some* union item type, whereas for normal unions it has to be supported for *all* types. Regular unions wouldn't really work either because it would actually be more restrictive than, say, `Match[str]`.\r\n\r\n[Here's some informal discussion that might make this clearer: For a value, a wider or larger type is more restrictive, because it supports fewer operations. For example, `object` is the widest ordinary type, and an expression (not lvalue) with type `object` only lets you do a few things with it such as `str(x)`. For a function argument, a wider type is more general/permissive from the caller's point of view, and an `object` argument accepts anything, and similarly for lvalues. So types act differently in these two contexts. `Match` types can be used both for values and function arguments, and the aim is to make this type permissive in both contexts, similar to how `typing.List` (`List[Any]`) is permissive. By defaulting to `re.Match[Any]`, it is permissive both in an argument/lvalue type context and a value context.]"}}
{"actor":{"display_login":"JukkaL"}}