f = lambda a, b, c: 0 # lambdas cannot have annotations
f.__annotations__['return'] = int # but you can set them manually
help(f) # superfluous ")" and missed last char
# <lambda> lambda a, b, c) -> in
import inspect
print(inspect.signature(f)) # correctly displays
# (a, b, c) -> int
This is a minor glitch for an atypical (perhaps even unsupported) use of annotations.
Bug report
help()output oflambdawith manually set__annotations__is slightly scrambled.Note
This is a minor glitch for an atypical (perhaps even unsupported) use of annotations.
Hypothesis
Perhaps
help()uses (the same logic as)inspect.signature()and (to reflectlambdasyntax) wants to drop the brackets "(...)", but then has a one-off error for its text slice (picking") -> in"instead of" -> int")Environment
Linked PRs
help(lambda_func)whenlambda_funchas `__annotati… #107401