Wednesday, September 22, 2021

Python - Lambda Type

 

LambdaType

types.LambdaType The type of user-defined functions and functions created by lambda expressions.

Here is a python example that tests if a variable is a lambda expression

import types
 
x = lambda d:d*d
 
if type(x) == types.LambdaType:
  print("x is a LambdaType")
else:
  print("x is not a LambdaType")
 

https://realpython.com/python-lambda/


No comments:

Post a Comment