Skip to content

Splatting keyword arguments #18

@GunnarFarneback

Description

@GunnarFarneback

I'm confused by this advice:

When writing a function that sends a lot of keyword arguments to another function, say sending keyword arguments to a differential equation solver, use a named tuple keyword argument instead of splatting the keyword arguments. For example, use diffeq_solver_kwargs = (; abstol=1e-6, reltol=1e-6,) as the API and use solve(prob, alg; diffeq_solver_kwargs...) instead of splatting all keyword arguments.

In my understanding of terminology, ... is the splatting operator and I would say that ; diffeq_solver_kwargs... is splatting the keyword arguments, but as that doesn't make sense here I assume something else is meant by splatting. Could this be clarified?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions