-
-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get the code of an unnamed lambda used as a function argument #583
Comments
What I've found in other cases is
|
Thanks! Is there a chance that |
I'm not sure what you mean.
|
Ah, now I see what you mean.
I think this holds true for working on the REPL. My original code in https://stackoverflow.com/q/75787845, saved as some So there may be a couple of intertwined issues, getting code from unnamed lambdas and getting code from unnamed lambdas on the REPL. My use case has nothing to with the REPL, so I am primarily interested in whether there is chance we will be able to extract an unnamed lambda's body inside a Python code file, be it using |
If I remember correctly, I probably didn't account for the case of extracting the source of an unnamed lambda where the reference to the lambda was extracted from a containing object. I assume this case needs to be added to the source parser (potentially using some dummy name for the lambda). |
Note that this case (an unnamed lambda) should also fail:
However, if the lambda is named, it works. |
similar, but different #221 |
Inspired by https://stackoverflow.com/q/75787845, I tried
dill.source
, and it appears to have the same issue(?) asinspect
:Output:
What I would like to be printed is
lambda: True
or evenTrue
, but instead I am getting the code of all offunction
.Others have pointed out my
lambda_argument
wasn't a lambda at all, but I believe the output shows it is one.The text was updated successfully, but these errors were encountered: