[Python-Dev] PEP 457: Syntax For Positional-Only Parameters
Larry Hastings
larry at hastings.org
Wed Oct 9 19:05:36 CEST 2013
On 10/09/2013 06:48 PM, Terry Reedy wrote:
> On 10/9/2013 9:51 AM, Larry Hastings wrote:
>
>> range() in
>> PyPy accepts keyword parameters, and in fact this works:
>>
>> range(9, step=2)
>>
>> That's way illegal in CPython.
>
> But Georg's point is that it does not have to be illegal in CPython.
> Range, in particular, does not have to be blazingly fast since it
> wraps loops rather than being in loops. I quite agree that it would be
> better to fix most functions.
First, if you're proposing to change the signature of range()... well,
good luck. Any proposals I made like that got shot down almost
immediately. I /think/ Guido said somewhere "range isn't changing.
deal with it.", though I admit I don't have a reference for that handy.
Also, if you're suggesting "change the semantics of builtins to get rid
of positional-only parameters", I've got a different example for you:
the dict constructor, which /must/ accept a single optional
positional-only parameter. The only way to simulate that in Python code
is with *args, but now introspection on that function will be
misleading, because the dict constructor doesn't accept more than one
positional-only argument.
And, as Georg suggests, these niggling inconsistencies are the
hobgoblins of my small mind.
//arry/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20131009/7d6f74e0/attachment.html>
More information about the Python-Dev
mailing list