Skip to content

fix(smoothing_length): require positional arguments before / - #339

Open
KTQ0912 wants to merge 1 commit into
SWIFTSIM:masterfrom
KTQ0912:fix/issue-234-positional-kwargs
Open

fix(smoothing_length): require positional arguments before /#339
KTQ0912 wants to merge 1 commit into
SWIFTSIM:masterfrom
KTQ0912:fix/issue-234-positional-kwargs

Conversation

@KTQ0912

@KTQ0912 KTQ0912 commented Jul 25, 2026

Copy link
Copy Markdown

Fixes #234

What changed

  • Marks coordinates, boxsize, kernel_gamma, neighbours, speedup_fac as positional-only in generate_smoothing_lengths.

Why

  • Previously, passing coordinates=... as a keyword confused _propagate_cosmo_array_attributes_to_result, because the decorator copies attributes from the first positional argument.
  • With positional-only parameters, Python raises a clear TypeError instead of the cryptic missing-argument error from the decorator.

Risk

  • Small API change: keyword usage for these first parameters will now raise TypeError. These inputs are almost always passed positionally in existing code/tests.

- Prevents confusing cryptic errors when users pass
  coordinates/boxsize as keyword arguments to
  generate_smoothing_lengths.
- Matches issue suggestion to mark early parameters as positional.

Fixes SWIFTSIM#234
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.

Positional arguments passed as kwargs confuse some decorators

1 participant