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