[Python-3000] PEP 3102

Dj Gilcrease digitalxero at gmail.com
Fri Feb 15 03:28:28 CET 2008


On Thu, Feb 14, 2008 at 6:04 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
>  > Now can you come up with a syntax for positional-only
>  > arguments? So far everybody has failed at that, and there are some use
>  > cases where it's useful too.
>
>  def foo(*(a, b,c)):
>    ...
>
>  i.e. catch them in a * arg which is unpacked in-place.

I thought the ability to do that was being removed in py3?


throwing some ideas around, for all examples arg1 and arg2 would be
positional only

def test(<arg1, arg2>, arg3, *arg4):
   ...

It's ok, since it clearly groups the positional only args, but the
parser might not be able to handle this.

def test(|arg1, |arg2, arg3, *, arg4):
    ...

Simple, but inelegant. In just looking at the code it seems wrong.

def test(arg1, arg2, |, arg3, *, arg4):
    ...

I like this idea better, use the pipe as a separator for positional
only, and normal arguments.


More information about the Python-3000 mailing list