Valentino Volonghi's Weblog

Greetings mercenaries!

Monday, June 28, 2004

Today, while surfing The Net, I bumped into this blog post from Marco Russo, a C# programmer.

Basically he is saying that generics are such a great feature because with them you can write stuff like this:

List integers = new List();
for(int i=1; i<=10; i++) integers.Add(i);
int sum;
integers.ForEach(delegate(int i){ sum+=i; });

Now, after reading that thing 3 times I realized that all it was doing was to sum the first 10 integers which can be done in this way using python:

sum([x for x in xrange(11)])

Maybe times will come, when people will realize that such poor languages, like C# or java, are nowhere near highly dynamic ones like Python. And machine power is not giving them any reason to be learned.

2 Comments:

At 8:45 PM, Blogger Valentino said...

Yes, you can, but then you wouldn't do the same thing that the C# code did.

Since that code is creating a list and adding each element to that list then summing each element. Yes, sum builds a list, but what if those numbers, instead of being the first 10 integers, were the first 10 prime numbers? then range wouldn't have worked anymore.

 
At 4:55 PM, Anonymous Anonymous said...

www.erlang.org

 

Post a Comment

<< Home