I need some opinions about lambda function in python.
I have been using Lambda function in python. For example, DirList = [i for i in tmp if "PC" in i].
However today I heard that one lecturer said that lambda function is not required in python3.
I have been taught that if I use lambda properly, my code can be more efficient because rather than using statement(if, for, etc.), lambda is treated as an expression which causes less computational burden. But now I'm confused about whether I should use lambda.
DirList = [i for i in tmp if "PC" in i]doesn't use a lambda expression at all. In any case, yes,lambdaexpressions are not necessary, though sometimes people prefer them for convenience/readability. For what it's worth, Guido wanted to removelambdafrom Python 3lambdain it. Because of this, it's not clear what you're talking about. Is the example wrong? Or are you really talking about list comprehensions? In which case, are you sure that you understood what the lecturer was talking about?