On Mon, Nov 26, 2018 at 6:54 AM Iwo Herka <iwohe...@gmail.com> wrote: > > > That said, though: if you want to distinguish a lambda function from a > > def function, you can do so with reasonable reliability using the > > function's name: > > That's what I'm using currently, thank you for the suggestion. > Nonetheless, it feels hacky - that's why I tried to use LambdaType and, > to my surprise, it didn't do the job. >
Yeah, not surprised you got surprised by that! But the real question is: why do you care about the difference? What is it in your code that cares about whether a function was created with "def" or with "lambda"? My suspicion is that, in most cases, the difference actually *is* the name (for instance, you might identify 'def' functions by name, but 'lambda' functions by identity), so it's not hacky to use the __name__ to distinguish them. ChrisA -- https://mail.python.org/mailman/listinfo/python-list