C#3.0 and lambdas

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sun Sep 18 09:22:17 EDT 2005


On Slashdot there is a discussion about the future C#3.0:
http://developers.slashdot.org/developers/05/09/18/0545217.shtml?tid=109&tid=8

http://msdn.microsoft.com/vcsharp/future/

There are many differences, but it looks a bit more like Python:
http://download.microsoft.com/download/9/5/0/9503e33e-fde6-4aed-b5d0-ffe749822f1b/csharp%203.0%20specification.doc

I like the lambda sintax enough. If there is a single parameter the
parentheses may be omitted. They are required if there aren't
parameters. The statement body allows the lambda to do anything.

x => x + 1                 Expression body
x => { return x + 1; }     Statement body
(x, y) => x * y            Multiple parameters
() => Console.WriteLine()  No parameters

The syntax seems nice, but for python the "Statement body" syntax can
be a problem.

Bye,
bearophile




More information about the Python-list mailing list