On 4 November 2017 at 03:53, Nick Coghlan <ncogh...@gmail.com> wrote: > If I understand correctly, a lot of the complexity in the current > typing.py implementation is there to make isinstance and issubclass do > something "useful" at runtime, and to allow generics to be used as > base classes. > > If it wasn't for those design goals, then "typing.List[int]" could > just return a lightweight instance of a regular class rather than a > usable Python class definition.
+1 to this. > If I'm right about that, then PEP 560's proposal to allow types to > implement a hook that says "Replace me with this other object for > runtime subclassing purposes" may be enough to let you delete most of > the current code in the typing module - you'd just need to have > isinstance and issubclass respect that new hook as well, and define > the hooks as returning the relevant ABCs. That would seem ideal to me. Lukasz Langa said: > So, the difference is in perceived usability. It's psychological. Please, let's not start the "not in the stdlib isn't an issue" debate again. If I concede it's a psychological issue, will you concede that the fact that it's psychological doesn't mean that it's not a real, difficult to solve, problem for some people? I'm also willing to concede that it's a *minority* problem, if that helps. But can we stop dismissing it as a non-existent problem? Paul _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com