2

How can I print the inside of a lambda function?

For example, from the following lambda expression:

lambda a, b: a / b

I want to receive:

a / b

Or from this expression:

lambda a, b: math.pow(a, b)

To receive:

pow(a, b)
7
  • 2
    A lambda is a function. You're asking to print the source code of the function in nicely human readable format. You can't just do that Commented Jan 6, 2020 at 9:40
  • Does this answer your question? How can I get the source code of a Python function? Commented Jan 6, 2020 at 9:41
  • 3
    Why/how should lambda a, b: math.pow(a, b) result in just pow(a, b)…? Commented Jan 6, 2020 at 9:42
  • 1
    I don't think the tagged question has a direct answer for the question. It only has explained how to get the source code. using the same inspect library you can apply a regular expression to get what is needed. I dont see a reason to downvote or close this question Commented Jan 6, 2020 at 9:47
  • 2
    It is already answered : stackoverflow.com/questions/334851/… Commented Jan 6, 2020 at 9:48

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.