|
|
|
|
|
by akubera
340 days ago
|
|
The PEP: https://peps.python.org/pep-0736/ The discussion: https://discuss.python.org/t/pep-736-keyword-argument-shorth... The rejection: https://discuss.python.org/t/pep-736-shorthand-syntax-for-ke... Grammar changes, in particular things used everywhere like function invocations, have to be worth paying the price for changing/adding new rules. The benefits of fewer characters and more explicit intention weren't enough to outweigh the costs. There were other considerations: Do linters prefer one syntax to another? Does the name refer to the parameter or the argument in tooling? Should users feel pressure to name local variables the same as the function's parameters? What about more shorthand for common cases like func(x=self.x, y=self.y)? I personally did not like the func(x=, y=) syntax. I think their example of Ruby's func(x:, y:) would actually make more sense, since it's syntax that would read less like "x equals nothing", and more "this is special syntax for passing arguments". |
|
Said as a curmudgeon that has never used a walrus.