3 ms·
> I also cannot honestly think of a case where I want that behaviour. There's plenty of situations where a named argument does not help, and encoding it can on
by masklinn 7y ago
> I also cannot honestly think of a case where I want that behaviour.
There's plenty of situations where a named argument does not help, and encoding it can only hurt. It makes little to no sense to name the first argument to `dict.update` for instance. Or the argument to `ord`.
That, incidentally, is why Swift added support for positional-only parameters (though it has no concept of keyword-or-positional).
- riffraff 7y agoIt does not help but doesn't hurt enough to grant a special syntax to avoid it. Yes, it limits your ability to rename a local variable, but that seems minor.
- Razengan 7y ago> That, incidentally, is why Swift added support for positional-only parameters (though it has no concept of keyword-or-positional). Swift's syntax is a lot more intuitive and consistent: function(parameterWithImplicitlyRequiredLabel: Int, differentArgumentLabel internalParameterName: Int, _ parameterWithoutLabel: Int, variadicParameterWithLabel: Int...) which you would call as function(parameterWithImplicitlyRequiredLabel: 1, differentArgumentLabel: 2, 3, variadicParameterWithLabel: 4, 5, 6, 7) [0] https://docs.swift.org/swift-book/LanguageGuide/Functions.html#ID166 https://docs.swift.org/swift-book/LanguageGuide/Functions.ht...