3 ms·
One of the use-cases for positional-only arguments strikes me as being very sensible: def my_format(fmt, *args, **kwargs): ... fmt.format(*
by nneonneo 7y ago
One of the use-cases for positional-only arguments strikes me as being very sensible:
def my_format(fmt, *args, **kwargs):
...
fmt.format(*args, **kwargs)
suffers from a bug if you want to pass fmt as a keyword argument (e.g. `my_format('{fmt}', fmt='int')`). With positional-only arguments that goes away.
You could always force developers into using your code the way you expect by parsing args/kwargs yourself, so it's not like this really changes anything about the "restrictiveness" of the language.