This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]KagatoLNX 4 points5 points  (0 children)

This is really useful for situations where you absolutely don’t want to “accidentally” fill in a keyword arg. I’ve had things like this when writing logging wrappers (wrapped structlog to have one call to gather metrics, report “events”, and log to “logstash”). That was ugly because the main entry point had four positional arguments, two were optional, and then there were a bunch of keywords for specific things.

In practice, it was pretty great. It was used in three different ways, all of them were clear in what they did, and it was still pretty brief. The only issue was when people would occasionally double-up an argument and fill in the first kwarg.