I'm running into something that may make me require parentheses around lambda's argument list. Basically, I'm settled on the following syntax for adding optional annotations (formerly known as type declarations :-) to parameters definitions:
def foo(arg1name: typeexpr = defaultexpr, arg2: typeexpr = defaultexpr, ...): ... But the same syntax production that's used for formal parameters inside parentheses is also used *without* parentheses in the syntax for lambda. Unfortunately the above extension makes it ambiguous; when the parser sees lambda arg1name : ... it can't tell whether the colon is the colon that ends the formal parameter list or whether it's a colon that introduces an optional parameter annotation. I really don't want to restart the syntax debate for parameter annotations, so I feel forced to require parentheses around lambda's parameter list. Fortunately this is at least one of those things that we can fix with a purely syntactical source code transformation... -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
