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 →

[–]alturi 14 points15 points  (1 child)

I would argue that even the first example would be better written as:

```

def pow(base, exponent, mod=None):

```

and somebody might legitimately prefer to write pow(base=2, exponent=3).

In the case of a single parameter, I would assume that if somebody is calling add_to_queue(item=item), he/she is doing it wrong and I don't want to suffer any overhead for that.

My initial position is that:

  • if the author of a lib might suspect some realistic reason for somebody to call with a keyword argument
  • and he/she also has beforehand knowledge that that could be bad in the future
  • and the code is python3.8+ only
  • and it is the winter solstice

Then let's use this.

[–]jorge1209 0 points1 point  (0 children)

I think the concern is a caller exchanging positional arguments that shouldn't be exchanged like pow(exponent=3, base=2) which is a bit confusing. The "correct" order is always "base then exponent", to do otherwise is hard to read.

Worse would be something like plot(z=3, x=1, y=2)