method (a, b = '', *c, **d): gets a syntax error?

Andreas Neudecker a.neudecker at uni-bonn.de
Fri Aug 29 13:58:03 EDT 2003


Hi.

Terry Reedy wrote:

> Generaly, when reporting 'I got an error', you should copy the actual
> error message. 

Will do from now. Thanks.

> In this case, I presume you got 'SyntaxError: invalid
> syntax' for each of your two syntax errors.

Exactly. Got one. As Michael Peuser states, the comma behind the last 
parameter is fine. I am doing this all the time when the list is long 
and I write it one parameter per line, because it makes swapping order 
or adding another parameter less error-prone (how often have you 
forgotten to add the comma to the previous parameter when adding a new 
'last one').

> 1. When you make a function call and use **whatever, it must be the
> last item in the argument list, just as in a function definition.

I knew that. That was what puzzled me. And the pointer of the error 
message pointed to the comma. So I simply overlooked that I had 
forgotten the 'def' - what a dumb bug!

> Welcom to Python.  Enjoy.

I do. Used to do some C long, long ago. Python is so much more 
comfortable ...

Regards


Andreas





More information about the Python-list mailing list