Skip to content

fix: apply the dfn Narwhals shortcut in pre= to any function, including with selectors and segments - #458

Merged
rich-iannone merged 3 commits into
mainfrom
fix-pre-dfn-named-functions
Oct 15, 2026
Merged

rich-iannone merged 3 commits into
mainfrom
fix-pre-dfn-named-functions

Conversation

@rich-iannone

Copy link
Copy Markdown
Member

A pre= function with a dfn parameter now always receives a Narwhals DataFrame, whether it's a lambda, a named function, or another callable. This is checked from the function's signature instead of a regex on its source text, which missed named functions and lambdas assigned to a variable. The shortcut also now works together with col() column selectors and segments=, which ignored it before. The user guide's Narwhals section shows the named-function form.

@rich-iannone
rich-iannone merged commit 73afcd4 into main Oct 15, 2026
10 checks passed
@rich-iannone
rich-iannone deleted the fix-pre-dfn-named-functions branch October 15, 2026 02:03

This branch was successfully deployed

1 active deployment
pr-458 — e97d4f4e Deployed Oct 15, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant