Skip to content

Conversation

@jl-wynen
Copy link
Member

Similarly to #3797 this allows more flexible dict-like arguments in some functions. I specifically ran into this when using da.assign_coords(other.coords) which should intuitively be allowed. But mypy complained because assign_coords required a dict. (There was no problem at runtime.)

Note that there are two changes in behaviour:

  • This PR makes the code more flexible and allows iterators over tuples as well as mappings. This should cover the types that one would typically pass to dict().
  • Passing the same argument via the dict like arg and kwargs now raises TypeError instead of ValueError. This matches the existing behaviour of bin, hist, etc. and more closely matches the typical error you get from bad function calls.

@github-project-automation github-project-automation bot moved this to In progress in Development Board Dec 11, 2025
@jl-wynen jl-wynen moved this from In progress to Selected in Development Board Dec 11, 2025
@jl-wynen jl-wynen merged commit 0315424 into main Dec 11, 2025
4 checks passed
@jl-wynen jl-wynen deleted the flexible-dict-args branch December 11, 2025 09:52
@github-project-automation github-project-automation bot moved this from Selected to Done in Development Board Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants