You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For completeness, the call and callwith functions should support the Values abstraction, for unpacking multiple and/or named return values into function arguments. The function composition utilities already support this.
Instead of *a and **kw, if given exactly one positional argument x, and type(x) is Values, then unpack it, thus populating *a and **kw.
Implemented in 5bcf3d4, generalized in dfe73ee, for 2.2.0.
call and callwith now unpack Values in their positional arguments. Each Values expands in place, left-to-right: its rets splice into the positional arguments, its kwrets merge into the keyword arguments. Across multiple Values and the explicit kwargs, rightmost wins per unique keyword name (explicit kwargs are syntactically last, so they always override).
Mirrors Python's familiar spread/merge semantics — [*a, *b, c] for the positional side, {**a, **b} for the keyword side. The use case is taking a Values produced by one function and applying it as the arguments to another — including spread-and-override patterns where a Values carries defaults and explicit kwargs override individual keys.
Trigger uses isinstance (not strict type is), matching the existing Values-output handling in unpythonic.fun's composition utilities (fun.py:908). The type is tuple check in valuify is qualitatively different: there it's recognising the pythonic tuple-as-multiple-return-values idiom, where exactness matters.
The first iteration (5bcf3d4) was a leading-position-only unpack with trailing-args override, justified using a curry-passthrough scenario. On closer inspection (fun.py:361–437), curry has its own dedicated Values-merging logic with a callable-leftmost promotion that doesn't generalize, so the curry argument didn't actually motivate any special-casing in call/callwith. The follow-up (dfe73ee) drops the asymmetry and treats this as plain spread.
Implementation factored into a private _maybe_unpack_values(args, kwargs) helper, shared by call and callwith. For callwith, the unpack runs at definition time (when args/kwargs are frozen), so the inner closure captures the already-expanded values.
Logged under Changed in CHANGELOG; tests in unpythonic/tests/test_funutil.py.
Activity
Technologicat commentedon May 4, 2026
Implemented in 2.2.0.
—Technologicat
Technologicat commentedon May 4, 2026
Implemented in 5bcf3d4, generalized in dfe73ee, for 2.2.0.
callandcallwithnow unpackValuesin their positional arguments. EachValuesexpands in place, left-to-right: itsretssplice into the positional arguments, itskwretsmerge into the keyword arguments. Across multipleValuesand the explicitkwargs, rightmost wins per unique keyword name (explicitkwargsare syntactically last, so they always override).Mirrors Python's familiar spread/merge semantics —
[*a, *b, c]for the positional side,{**a, **b}for the keyword side. The use case is taking aValuesproduced by one function and applying it as the arguments to another — including spread-and-override patterns where aValuescarries defaults and explicit kwargs override individual keys.Trigger uses
isinstance(not stricttype is), matching the existingValues-output handling inunpythonic.fun's composition utilities (fun.py:908). Thetype is tuplecheck invaluifyis qualitatively different: there it's recognising the pythonic tuple-as-multiple-return-values idiom, where exactness matters.The first iteration (5bcf3d4) was a leading-position-only unpack with trailing-args override, justified using a curry-passthrough scenario. On closer inspection (
fun.py:361–437), curry has its own dedicatedValues-merging logic with a callable-leftmost promotion that doesn't generalize, so the curry argument didn't actually motivate any special-casing incall/callwith. The follow-up (dfe73ee) drops the asymmetry and treats this as plain spread.Implementation factored into a private
_maybe_unpack_values(args, kwargs)helper, shared bycallandcallwith. Forcallwith, the unpack runs at definition time (when args/kwargs are frozen), so the inner closure captures the already-expanded values.Logged under Changed in CHANGELOG; tests in
unpythonic/tests/test_funutil.py.— Claude (Opus 4.7)
doc/features: document Values spread in call/callwith (#86)
Release 2.2.0 "Hail Eris"