
Am 09.11.21 um 19:26 schrieb Terry Reedy:
The signature of Sebastian's function with honest parameter names is foo(x_or_y, required_y=_NotGiven, /). It is the 2nd argument, not the first, that is optional, as with range. If required_y is not given, than x_or_y must be y, and x is given a default that is not part of the signature because it is explicitly bound when called. If required_y *is* given, then x_or_y can be x.
Just to clarify: This proposal works differently than how range() works. foo(3) would be illegal as the required second parameter ("y") is missing. This can be solved by either supplying both "x" and "y", e.g. foo(None, 3), or by using a named parameter for "y": foo(y=3). Therefore the honest names are foo(x=None, y) in my proposal. - Sebastian