<p>I've written such decorators too, but they've got quite a bit of overhead...</p>
<p>--Guido van Rossum (sent from Android phone)</p>
<div class="gmail_quote">On Mar 2, 2012 11:43 AM, "Arnaud Delobelle" <<a href="mailto:arnodel@gmail.com">arnodel@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 2 March 2012 19:28, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br>
> On Fri, Mar 2, 2012 at 4:13 AM, Nick Coghlan <<a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>> wrote:<br>
>> On Fri, Mar 2, 2012 at 6:43 PM, Steven D'Aprano <<a href="mailto:steve@pearwood.info">steve@pearwood.info</a>> wrote:<br>
>>> +1 on adding keyword arguments to built-in methods and functions where they<br>
>>> would help readability, e.g str.find(c, start=23), even if this happens in a<br>
>>> ad-hoc fashion.<br>
>><br>
>> Indeed, this is the approach we have taken to date. For example,<br>
>> str.split() recently gained keyword support for 3.3 because<br>
>> "text.split(maxsplit=1)" is less cryptic than "text.split(None, 1)".<br>
>><br>
>> It makes the most sense when at least one of the following holds:<br>
>> - the second argument accepts a number that is unclear if you're not<br>
>> familiar with the full function signature<br>
>> - the earlier arguments have sensible default values that you'd prefer<br>
>> not to override<br>
>><br>
>> So +1 on declaring "make X support keyword arguments"<br>
>> non-controversial for multi-argument functions, +0 on also doing so<br>
>> for single argument functions, but -0 on attempting to boil the ocean<br>
>> and fix them wholesale.<br>
><br>
> Hm. I think for many (most?) 1-arg and selected 2-arg functions (and<br>
> rarely 3+-arg functions) this would reduce readability, as the example<br>
> of ord(char=x) showed.<br>
><br>
> I would actually like to see a syntactic feature to state that an<br>
> argument *cannot* be given as a keyword argument (just as we already<br>
> added syntax to state that it *must* be a keyword).<br>
<br>
There was a discussion about this on this list in 2007.  I wrote some<br>
decorators to implement it this functionality.  Here's one at<br>
<br>
<a href="http://code.activestate.com/recipes/521874-functions-with-positional-only-arguments/?in=user-4059385" target="_blank">http://code.activestate.com/recipes/521874-functions-with-positional-only-arguments/?in=user-4059385</a><br>

<br>
(note that it didn't attract a lot of attention !).  The recipe also<br>
refers to the original discussion.<br>
<br>
--<br>
Arnaud<br>
</blockquote></div>