On Wed, May 15, 2019 at 3:45 AM Anders Hovmöller <boxed@killingar.net> wrote:
On 15 May 2019, at 07:51, Jonathan Goble <jcgoble3@gmail.com> wrote:
That's not a realistic goal; there are some use cases, including in CPython builtins, that cannot be accomplished without positional-only arguments. For example, the current behavior of the `dict` constructor is to accept both certain iterables as a positional-only argument and/or keyword arguments from which a dict can be created. If the iterable argument was not positional-only, then it would be forced to consume a keyword (even if the caller passes it as a positional argument), meaning that that keyword could never be included in **kwargs and could not become a dict key via keyword arguments.
You lost me. How is this not handled by *args and **kwargs? I think it is. "Positional only" isn't needed in this case.
Because `def func(*args, **kwargs):` obfuscates the true signature, making `help()` and the `inspect` module less useful and forcing one to analyze the implementation code or study the docs to understand what and how many arguments are actually expected.