Skip to content

ENH: expand call signature of cycler() #12

@WeatherGod

Description

@WeatherGod

In the discussions going on over in matplotlib/matplotlib#4686, some have asked for the cycler() call signature to be expanded a bit. Now, this can be a rabbit hole, so I will break out the proposal into stages so that we can decide just how deep we want to go:

Current signature (I call this the simple positional):
cycler(key, vals)

  1. Allow a single kwarg to be equivalent to the current notation:
    cycler(k=vals)
    Example:
    cycler(color='rgb') vs.
    cycler('color', 'rgb')

  2. Allow for multiple kwargs (all assumed to be "added" together):
    cycler(k1=v1[, k2=v2, ...])
    Example:
    cycler(color='rgb', lw=[1, 2, 3]) vs.
    cycler('color', 'rgb') + cycler('lw', [1, 2, 3])

  3. Allow for multiple positional args (all assumed to be "multiplied" together):
    cycler(k1, v1[, k2, v2, ...])
    Example:
    cycler('color', 'rgb', 'lw', [1, 2, 3])
    cycler('color', 'rgb') * cycler('lw', [1, 2, 3])

For 2 & 3, I would completely disallow the mixing of positional and keyword arguments.
If we want to avoid having two different operations possible from a single cycler(), we could forgo option 3, and go for the following:
3alt) Allow for both positional and kwargs, but assume all to be "added" together:
cycler(k1, v1[, *args][, k3=v3, **kwargs])

Whichever option (if any) people want, I can put together a PR that implements that. Ideally, I would like to have cycler.cycler() to have very similar, if not identical, call signatures to my validating version that I am making in the matplotlib PR referenced above.

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