Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Indicate in the docs that static typing doesn't work with lambda functions #2020

Open
@Dr-Irv

Description

@Dr-Irv

I sometimes get asked why a lambda function can't be type-checked. And I believe the answer is that the arguments and result of a lambda can't be inferred by a static type checker.

It might be worth adding something at https://typing.python.org/en/latest/spec/callables.html#callables that tells people that lambda functions can't be type checked (or if they can, what are the restrictions), and that the workaround is to create a typed function def that does what the lambda does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions