On Wed, Mar 1, 2017 at 9:26 PM Serhiy Storchaka <storch...@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?
>
> <snip>


> 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.
>

I like the idea, but I wanted to note that since it has no meaning from the
point of view of the defined function, it can be done with a magic
decorator, so new syntax is not required:

@positional_only[:4]
def replace(self, old, new, count=-1):
    ...

It may ease googling and backporting, by defining positional_only[slice] to
be the identity function.

Elazar
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to