{"action":"created","issue":{"url":"https://api.github.com/repos/python/typing/issues/283","repository_url":"https://api.github.com/repos/python/typing","labels_url":"https://api.github.com/repos/python/typing/issues/283/labels{/name}","comments_url":"https://api.github.com/repos/python/typing/issues/283/comments","events_url":"https://api.github.com/repos/python/typing/issues/283/events","html_url":"https://github.com/python/typing/pull/283","id":177681154,"number":283,"title":"[WIP] Kill __subclasscheck__","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":1,"created_at":"2016-09-18T22:18:25Z","updated_at":"2016-09-18T23:17:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/python/typing/pulls/283","html_url":"https://github.com/python/typing/pull/283","diff_url":"https://github.com/python/typing/pull/283.diff","patch_url":"https://github.com/python/typing/pull/283.patch"},"body":"This PR:\r\n* Fixes #136 \r\n* Fixes #133 \r\n* Partially fixes #203 (fixes the ``isinstance`` part, and multiple inheritance, still ``typing.Something`` is not a drop-in replacement for ``collections.abc.Something`` in terms of *implementation*).\r\n* Makes almost everything up to 10x faster.\r\n* Is aimed to be a minimalistic change. I only removed ``issubclass`` tests from ``test_typing`` and main changes to ``typing`` are ``__new__`` and ``__getitem__``.\r\n\r\nThe idea is to make most things not classes. Now ``_ForwardRef()``, ``TypeVar()``, ``Union[]``, ``Tuple[]``, ``Callable[]`` are not classes (i.e. new class objects are almost newer created by ``typing``).\r\n\r\nUsing ``isinstance()`` or ``issubclass()`` rises ``TypeError`` for almost everything. There are exceptions:\r\n* Unsubscripted generics are still OK, e.g. ``issubclass({}, typing.Mapping)``. This is done to (a) not break existing code by addition of type information; (b) to allow using ``typing`` classes as a replacement for ``collections.abc`` in class and instance checks. Finally, there is an agreement that a generic without parameters assumes ``Any``, and ``Any`` means fallback to *dynamic* typing.\r\n* ``isinstance(lambda x: x, typing.Callable)`` is also OK. Although ``Callable`` is not a generic class, when unsubscribed, it could be also used as a replacement for ``collections.abc.Callable``.\r\n* The first rule for generics makes ``isinstance([], typing.List)`` possible, for consistency I also allowed ``isinstance((), typing.Tuple)``.\r\n\r\nFinally, generics should be classes, to allow subclassing, but now the outcome of ``__getitem__`` on classes is cached. I use an extended version of ``functools.lru_cache`` that allows fallback to non-cached version for unhashable arguments.\r\n\r\nThis is still WIP, since I did this only for Python 3.\r\n\r\n@gvanrossum @JukkaL Please take a look."},"comment":{"url":"https://api.github.com/repos/python/typing/issues/comments/247888939","html_url":"https://github.com/python/typing/pull/283#issuecomment-247888939","issue_url":"https://api.github.com/repos/python/typing/issues/283","id":247888939,"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},"created_at":"2016-09-18T23:17:10Z","updated_at":"2016-09-18T23:17:10Z","body":"@gvanrossum @JukkaL \r\nIt looks like this PR also fixes http://bugs.python.org/issue26075, http://bugs.python.org/issue25830, and http://bugs.python.org/issue26477\r\n\r\nI added this to the description."}}
{"actor":{"display_login":"ilevkivskyi"}}