On 18/06/16 20:04, boB Stepp wrote: > py3: def d(row, col/2, radius=5): > File "<stdin>", line 1 > def d(row, col/2, radius=5): > ^ > SyntaxError: invalid syntax > > And this surprised me. It seems that only identifiers are allowed as > parameters in a function definition statement, and I cannot help but > wonder why?
What are the parameters (as opposed to the arguments)? They are names. They are keys in the local dictionary used by the function to look up the values passed in as arguments. You cannot use an expression as a key in a dictionary. If you try, Python tries to evaluate the expression and uses the result if its valid or throws a nameerror etc. hth -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor