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.

5 Comments:

At 8:17 PM, Blogger verbat said...

you may just do:
sum(xrange(11))
zermelo frankel list comprehension are highly overrated and abused, on the lines of unix's cat utility.

 
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, Blogger Linucs said...

www.erlang.org

 
At 11:01 AM, Anonymous Anonymous said...

Internet Romance is Becoming #1 Robot Food
Hot Sexual dating personals
Sexy Chat/Web-Cam

1. Hot Match - Maker
2. Fulfill your Passion
3. Sex and Swingers

OFF Topic... Please Delete if not OK!

 
At 8:56 PM, Anonymous Anonymous said...

I just bookmarked your blog. I will try to post often.

Do you think gas pricing is ever going to go down? I founds some gas saving tips at pizza coupon


Keep in touch :)

 

Post a Comment

Links to this post:

Create a Link

<< Home