structurizr-python icon indicating copy to clipboard operation
structurizr-python copied to clipboard

Allow name and description arguments to elements to be positional

Open yt-ms opened this issue 4 years ago • 1 comments

Checklist

Is your feature related to a problem? Please describe it.

When constructing a model from Python (rather than manipulating an existing one), it would be natural and more compact to be able to specify both the name and description of an element positionally rather than having to explicitly name them:

c1 = Container("Mobile app", "Application running on mobile devices")

See also Midnighter/structurizr-python#13

Describe the solution you would like.

class Container(StaticStructureElement):
    def __init__(
        self,
        name: str = "",
        desctription: str = "",
        *,
        parent: "SoftwareSystem" = None,
        technology: str = "",
        components: Iterable[Component] = (),
        **kwargs
    )

yt-ms avatar Sep 27 '20 10:09 yt-ms

I guess it's a matter of style. I definitely prefer named keyword arguments for instantiation (makes it safer in my opinion). @ilaif prefers keyword arguments everywhere :smiley:

However, I don't need to force my style on others. So I'm not opposed to this change.

Midnighter avatar Sep 27 '20 13:09 Midnighter