Closed FFY00 closed 1 year ago
This code makes me sad. It looks like the typing system requires overloads anywhere where a None
is the default fallback object? It took me many minutes just to try to comprehend what's going on here and it's degrading the readability of the get_all
method. The reader now has to incorporate additional concepts (Optional
, overload
) and reconcile the two interfaces just to reason about what, without typing checks, is a simple concept (failobj=None
).
Moreover, this test fails the diffcov because it fails to cover the new line 23 (an ellipsis).
What ever happened to "elegance begets simplicity"?
Is there any expectation that this behavior will ever be simplified? I guess I can link to the PRs for those who need to track down the origin.
For reference - upstream change at https://github.com/python/typeshed/pull/9620 and possible long-term simplification at https://github.com/python/typing/issues/307.
This change also introduces errors in the docs build:
/home/runner/work/importlib_metadata/importlib_metadata/importlib_metadata/_meta.py:docstring of typing._overload_dummy:1: WARNING: py:class reference target not found: _T
Fixes #434