On 16 May 2019, at 08:50, Serhiy Storchaka <storchaka@gmail.com> wrote:
16.05.19 08:46, Anders Hovmöller пише:
In the general case because of features that until / was introduced was unique to functions defined in C. But in the case of the dict constructor that's just a weird misfeature. If it did in fact take *args and handled it it would be perfectly fine and useful. It would have meant people wouldn't have written all those merge() utility functions over the years. And it would make dict(a, b) valid syntax instead of the current overly verbose dict(**a, **b). For / to be a good idea one needs a strong argument for why a function must exist that tales a bounded amount of arguments (ie not *args) where calling it with the parameters named would be a bad thing. There are certainly cases where the names don't add much, like most functions with one argument but that is a different thing.
The dict constructor is just one example. There are around 60 Python functions in the stdlib which will benefit from adding support of positional-only arguments. Look at https://github.com/python/cpython/pull/12620.
Writing the code that parses args is errorprone and inefficient.
There are also other rationales of PEP 570.
I've read it. It is unconvincing to me. / Anders