[Python-ideas] Positional-only parameters

Terry Reedy tjreedy at udel.edu
Wed Mar 1 15:52:59 EST 2017


On 3/1/2017 2:53 PM, Guido van Rossum wrote:
> On Wed, Mar 1, 2017 at 11:25 AM, Serhiy Storchaka
> <storchaka at gmail.com
> <mailto:storchaka at gmail.com>> wrote:
>
>     On 28.02.17 23:17, Victor Stinner wrote:
>
>         My question is: would it make sense to implement this feature in
>         Python directly? If yes, what should be the syntax? Use "/" marker?
>         Use the @positional() decorator?
>
>
>     I'm strongly +1 for supporting positional-only parameters. The main
>     benefit to me is that this allows to declare functions that takes
>     arbitrary keyword arguments like Formatter.format() or
>     MutableMapping.update(). Now we can't use even the "self" parameter
>     and need to use a trick with parsing *args manually. This harms
>     clearness and performance.

> Agreed.

+ 1 also. When people write a Python equivalent of a built-in function 
for documentation or teaching purposes, they should be able to exactly 
mimic the API.

>     The problem with the "/" marker is that it looks ugly. There was an
>     excuse for the "*" marker -- it came from omitting the name in
>     "*args". The "*" prefix itself means an iterable unpacking, but "/"
>     is not used neither as prefix nor suffix.
>
>
> It's in a sense a pun -- * and / are "opposites" in mathematics, and so
> are the usages here.

Besides which, '/' has traditionally be used in non-numeric contexts as 
a separator, and in unix paths.


-- 
Terry Jan Reedy



More information about the Python-ideas mailing list