3 ms·
I don't know the history behind star args / kwargs, but I don't think what you're proposing is a good idea: * You wouldn't get TypeErrors for broken code. Most
by benhoyt 13y ago
I don't know the history behind star args / kwargs, but I don't think what you're proposing is a good idea:
* You wouldn't get TypeErrors for broken code. Most code doesn't use or need star args / kwargs, but if I understand correctly your first proposal, it'd mean no TypeErrors on function signatures, making it harder to find coding errors.
* Python has very few keywords on purpose, and I don't think they'd like adding the fairly generic, non-keyword-seeming names like "args" and "kwargs".
* "Explicit is better than implicit" is part of the Python philosophy. The single and double stars may "look ugly", but that's part of the point. They're not just ordinary variables, and they do something special, so they need to stand out.
* Your proposal of using __args__ is at least explicit in their use, but not in the function definition.
For what it's worth, I mostly use star args / kwargs in wrapper or "proxy" functions: functions that do something like logging and then call through to another function to do the main work.