[Python-3000] Type Expressions

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 20 11:19:59 CEST 2006


Some wilder ideas for keyword-only arguments:

   def spam(a, b, c, {d, e, f=x}):
     # d, e are mandatory keyword-only
     # f is optional keyword-only

Writing them inside {} is meant to make them look
like a set, therefore unordered.

Problem is it looks a little ugly when all you have
is keyword-only args:

   def spam({d, e, f=x}):
     ...

So maybe you should be able to write that as

   def spam{d, e, f=x}:
     ...

Then if you have some positional args as well,

   def spam(a, b, c){d, e, f=x}:
     ...

And incorporating all the possible features,

   def spam(a, b, c=y, *d){e, f=x, **g}:
     ...

Although now that the ** arg is inside the {}, there's
no longer any need for the double *, so it could just be

   def spam(a, b, c=y, *d){e, f=x, *g}:
     ...

--
Greg




More information about the Python-3000 mailing list