Repository navigation
Infer curry arity for fixed positional bound methods - #365
Merged
dgilland merged 2 commits intoOct 27, 2026
Merged
Conversation
Exclude the already supplied receiver when inferring arity for Python bound methods with fixed positional signatures. This lets both curry directions execute after the expected caller arguments and advertise the correct remaining argument count to collection iteratees. Preserve existing inference for keyword-only, variadic and unrelated callable signatures, as well as explicitly supplied arities. Signed-off-by: Mayank Dhingra <mayankdhingra02@gmail.com>
dgilland
requested changes
Oct 27, 2026
dgilland
left a comment
Owner
There was a problem hiding this comment.
- Tests should go into the corresponding
test_<module>.pyfile:test_functions.py(do not create a new test file) - Upstream has merge conflicts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
curry()andcurry_right()count the already bound receiver when inferring a Python method's arity. As a result,curry(obj.add)(1)(2)returns another curry wrapper instead of the result. A partially curried method used withmap_can also receive an unwanted collection index and raiseTypeError.Omit the implicit receiver for fixed positional bound methods. The remaining-argument count then matches the arguments callers supply, including inherited instance methods and class methods. Keyword-only and variadic signatures retain their existing inference; explicit arity and other callable types follow the existing behavior.
Regression coverage exercises both curry directions, repeated use, keyword accumulation, positional-only/default/zero-argument methods, and direct/chained collection pipelines. It also preserves static/unbound/partial/callable and keyword/variadic controls. Added the requested AUTHORS entry.
Validation: