Can you give an example where having multiple statements on one line wouldn't be less readable and debuggable? If either len(x) or len(y) were zero, a ZeroDivisionError would be thrown, but you wouldn't know whether or not it was x or y that caused it. Would a or b in the local scope be overwritten? Does the final "statement" have to be an expression or would None be returned as with named functions? Are we allowing return statements, e.g. "return (a+b)/2", which would allow returning early? If so, wouldn't it be more consistent with named functions to only be able to return with a return statement? Would all lambdas be required to end in double-semicolons? Single-statement ones? No-statement ones? If it were required, this would (in my opinion, unnecessarily) break old code. And if it didn't require it, wouldn't both of the following lines be valid: lambda x: x - 1; x + 3; lambda x: x - 1; x + 3;; which could be tricky to debug if one accidentally included/excluded an extra semi-colon. I think this idea needs some fleshing out. On Sat, Aug 24, 2013 at 10:24 PM, Musical Notation < musicdenotation@gmail.com> wrote:
What about this? lambda x, y: a = sum(x)/len(x); b = sum(y)/len(y); (a+b)/2;; The double-semicolon notation can also replace indentation for grouping of statements:
y=0 for x in list: y=2*y+x if y%13==0: y=12;;;; _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas