-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
CLN: replace lambdas with named functions so they are labeled in asv #24629
Conversation
Codecov Report
@@ Coverage Diff @@
## master #24629 +/- ##
==========================================
- Coverage 92.38% 92.37% -0.01%
==========================================
Files 166 166
Lines 52395 52395
==========================================
- Hits 48403 48402 -1
- Misses 3992 3993 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #24629 +/- ##
=======================================
Coverage 92.38% 92.38%
=======================================
Files 166 166
Lines 52395 52395
=======================================
Hits 48403 48403
Misses 3992 3992
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally OK with me. Some real nitpicky comments
return [[i, -i] for i in arr] | ||
|
||
|
||
def list_of_tuples_with_none(arr): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming nit but this is a generator expression not a list, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems the []
forces it into a list, making the outer parens a simple grouping. I'll remove the parens and add generator versions for clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - generators don't support +
, so didn't add them for this particular case
return ([(i, -i) for i in arr][:-1] + [None]) | ||
|
||
|
||
def list_of_lists_with_none(arr): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @jreback not sure if we are merging any non 0.24 items at the moment but think this is OK
thanks! |
This complements a PR in
asv
(airspeed-velocity/asv#771), but would be worthwhile on its own.asv
compares benchmarks based on therepr()
of the parameters, which causes issues when the parameter is an object that doesn't override the defaultrepr()
(such as functions, especially lambda functions):As the memory address component of the name changes between runs,
asv
fails at lining up the comparison. This has to be fixed upstream.However, passing
lambda
functions is particularly unhelpful, as we have no idea which of the six such objects are represented in the example above.This PR simply gives each function a descriptive name:
git diff upstream/master -u -- "*.py" | flake8 --diff