[Python-3000] Type Expressions

Ian Bicking ianb at colorstudy.com
Thu Apr 20 19:55:39 CEST 2006


Guido van Rossum wrote:
> On 4/20/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> 
>>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
> 
> 
> IMO anything using any kind of nested brackets inside the argument
> list is doomed. Such syntax is too close to resembling a single
> argument with a complex sub-structure, even if there's a prefix
> operator.

I thought I remembered some talk about removing sub-structure from 
functions signatures in py3k...?  It's a pretty obscure feature, and 
when the substructure pattern doesn't match the call the exception is 
hard to decypher.

   >>> def p((x, y)): pass
   >>> p(1)
   Traceback (most recent call last):
     File "<stdin>", line 1, in ?
     File "<stdin>", line 1, in p
   TypeError: unpack non-sequence

...that exception is actually considerably worse than I expected.


-- 
Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org


More information about the Python-3000 mailing list