-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
[Enhancement]: functools partial #290
Comments
The rule you mentioned is similar to Adding detection for In general, I think we can replace the following examples: lambda x: f(1, x)
lambda x: f(x, y=y)
lambda x, *y, **z: f(1, x, *y, **z) With this: partial(f, 1)
partial(f, y=y)
partial(f, 1) My only concern is that lambdas restrict the amount and types of arguments you can pass it, while |
Overview
The following pattern I've seen being used for returning a new function based on another function with prefilled variables:
functools.partial
exactly does this, without needing the lambda to pass the input argument again.Somewhat related to this rule, although there we can remove the whole statement, and here only the input argument.
Proposal
Could this rule be included in refurb? There is already a
functools
section.The text was updated successfully, but these errors were encountered: