[Python-Dev] PEP 457: Syntax For Positional-Only Parameters
Terry Reedy
tjreedy at udel.edu
Wed Oct 9 18:48:49 CEST 2013
On 10/9/2013 9:51 AM, Larry Hastings wrote:
> Again, I don't expect this syntax to be implemented any time soon. But
> this does raise a mild sore point: Maciej and Armin Rigo tell me that
> PyPy's implementation of range() looks like this:
>
> def range(x, y=None, step=None):
>
> The "None" above is not the Python None, it's RPython's internal None,
> so it's not available to Python programs. But this does mean 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.
--
Terry Jan Reedy
More information about the Python-Dev
mailing list