I agree with everything you're saying. Another reason to prefer keyword arguments is that they simplify the interface and make it easier to learn.
On Mon, Feb 3, 2014 at 6:30 PM, Andrew Barnert firstname.lastname@example.org wrote:
On Feb 3, 2014, at 14:11, Neil Girdhar email@example.com wrote:
Isn't the only reason that you don't like keyword arguments that take
constant values a matter of efficiency?
I'm pretty sure it's about clarity--letting you write what you mean, and making that meaning explicit at a glance--than performance. (On the rare occasions where performance makes a difference, surely you're already copying the method to a local variable anyway, right?)
Keyword arguments imply a dynamic choice, different functions a static one, in basically the same way as, say, keyed values vs. attributes. So, if it would be very rare to choose between foo and rfoo dynamically, it makes sense for them to be separate methods; if it's relatively common, it makes sense to have a single method.
(I'm not sure that it _would_ be rare, but if so, I agree with the rest of the argument against my point.)