Created
August 9, 2020 10:01
-
-
Save tk0miya/8a376ae67d3bca7d10f4c80ca5cd86f8 to your computer and use it in GitHub Desktop.
broken help is shown if the signature of lambda has return_annotation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python | |
Python 3.8.2 (default, Mar 2 2020, 00:44:41) | |
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> foo = lambda x = 1: 1 | |
>>> help(foo) | |
Help on function <lambda> in module __main__: | |
<lambda> lambda x=1 | |
>>> import inspect | |
>>> foo.__signature__ = inspect.signature(foo) | |
>>> help(foo) | |
Help on function <lambda> in module __main__: | |
<lambda> lambda x=1 | |
>>> foo.__signature__ = inspect.signature(foo).replace(return_annotation=int) | |
>>> help(foo) | |
Help on function <lambda> in module __main__: | |
<lambda> lambda x=1) -> in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment