-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add support for lambda functions #80
Conversation
Thanks @andrewcleveland , this is definitely helpful ! I wrote a few comments, mostly details - the principle is good. |
Hi @smarie, Per your note about |
Thanks a lot @andrewcleveland ! I have two minor comments, mostly to improve readability/ future maintenance, see above |
Hi @andrewcleveland , would you mind updating your PR according to the two comments above, so that we can merge ? Users of What is missing is just code comments in two sections. |
…bda functions to docstring
… no longer needed because we are using co_name
Hi @smarie, sorry for the delay. I did some work on this about a month ago and then kind of put it on the back burner. |
Thanks @andrewcleveland ! I had a few other comments, hopefully easy to cope with |
Co-authored-by: Sylvain Marié <[email protected]>
Co-authored-by: Sylvain Marié <[email protected]>
Co-authored-by: Sylvain Marié <[email protected]>
Hi @smarie, I made the changes you suggested. Moving the conditional
I moved the import to the bottom of main.py, but I'm not sure if that's the best way to resolve it. |
Thanks @andrewcleveland !
that way, the if/else can be moved to the top just after the imports, and there is no circular dependency anymore. Thanks! |
…_legacy_py.py` to `main.py`
@smarie, option 1 is done. |
All set, thanks a lot @andrewcleveland for your patience ! |
Adds to
create_function
a check iffunc_name
is'<lambda>'
, and if so builds a lambda expression instead of a regular function definition. This is passed in by@wraps(f)
whenf
is a lambda function.Without this,
create_function
builds a function definition'def <lambda>(...):'
which fails to compile.Also adds a test to verify the above is working.
Resolves #81.
(lambda: None).__name__
is used in place of'<lambda>'
in case a different Python implementation uses a different name.Coverage.py complains about the
lambda: None
not being run. I don't know if that's an issue or not.