File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,10 @@ you might as well just define a normal function. Let's call that our first worka
3535The second workaround is equivalent: assigning the lambda to a variable, and annotating
3636the type of that variable with a Callable.
3737
38- ``f: Callable[[object], object] lambda x: x ``
38+ ``f: Callable[[object], object] = lambda x: x ``
3939
4040Type comments on function definitions do not actually work on lambda, nor do
41- normal type comments help (although you can use a type commment on an assignment
41+ normal type comments help (although you can use a type comment on an assignment
4242to a variable with a lambda, of course; however this will have to be the Callable
4343syntax and not the function-arrow special one).
4444
@@ -48,8 +48,8 @@ type errors resulting from lambda expressions being deduced as ``Any``.
4848
4949In conclusion:
5050
51- 1. There is no way to explicitly annotation lambda arguments or return values in the
52- lmabdas themselves.
51+ 1. There is no way to explicitly annotate lambda arguments or return values in the
52+ lambdas themselves.
5353
54542. However, static typing rules still apply to lambdas, including type deduction.
5555
You can’t perform that action at this time.
0 commit comments