Repository navigation
Infer curry arity for callable objects and constructors - #463
Merged
dgilland merged 2 commits intoNov 15, 2026
Merged
Conversation
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.
Callable instances and class constructors with two positional parameters are currently inferred to need three arguments. For example, if an instance implements
__call__(self, left, right),curry(instance)(1)(2)returns another curry wrapper instead of invoking it. The extra argument count can also make a partially curried instance consume an unwanted collection index when used withmap_.Use the public signature for fixed positional callables so implicitly supplied receivers are excluded. Preserve
getfullargspec's existing treatment of wrappers withfollow_wrapped=False; explicit arity and inference for keyword-only or variadic signatures keep their current behavior. This extends the bound-method fix in #365 to callable instances and constructors, and updates the previous compatibility assertion that pinned a callable instance's arity to three.Tests cover both curry directions, positional-only callable instances, regular and inherited constructors, zero/default parameters, explicit arity, collection callbacks, and decorated function signatures. The required contributor entry and a changelog entry are included.
Validation on Windows:
src/pydash,tests, andtasks.pypassed. Strict Sphinx documentation and sdist/wheel builds passed. The regenerated chaining stub matches the checked-in Git blob after CRLF normalization.inv test's default exclusion oftests/pytest_mypy_testing. No tracked files changed during the final test runs.The native
inv cientry point stops because it requests a PTY unsupported on Windows; the corresponding build, documentation, lint, type, generated-stub, and test commands were run individually. Python 3.10/3.12/3.14 and other operating systems were not tested locally.AI assistance: OpenAI Codex assisted with investigation, implementation, and local verification.