A Python newbie question, why is this syntax invalid: lambda: pass, while this: def f(): pass is correct?
Thanks for your insight.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That is an error because after the colon you have to put the return value, so:
is equal to:
that indeed makes no sense and produces a
SyntaxErroras well.