From: ·······@ziplip.com
Subject: Python is not [yet] Considered Harmful
Date: 
Message-ID: <F5PTFQP4LSMMFZJQOCN2KCOHLUACIBHXMMEJCJEO@ziplip.com>
map(lambda f: f(1), [lambda x: x + 1 for i in range(3)])

Oh, OK, it was a typo (1 instead of i). I take it all back (for now).

It was an honest mistake, not a troll! Still, I think it should
be [1, 2, 3] instead of [3, 3, 3]

From: Hannu Kankaanp??
Subject: Re: Python is not [yet] Considered Harmful
Date: 
Message-ID: <840592e1.0310270526.75a99bb0@posting.google.com>
·······@ziplip.com wrote in message news:<········································@ziplip.com>...
> It was an honest mistake, not a troll! Still, I think it should
> be [1, 2, 3] instead of [3, 3, 3]

I don't think you understand what a troll is. Troll is someone
who posts any of the following:

1. "Python is Considered Harmful" (given it's highly readable syntax,
great libraries and high dynamicity, I can't see how a single
feature could make Python 'harmful'. The title could've just been
"Unexpected behaviour of closures inside list comprehensions")

2. "I present to you the final and ultimate proof of Python's
brain-damage" (again, a needless attack.. which turned against
yourself though)

3. "All this Python bashing is starting to feel like mocking
a retarded child..." (this doesn't need explanation, I hope)

And look, you posted all three of them in a single message!
Well, your typo gave us a good laugh nevertheless ;)

If you want [1, 2, 3], try:

map(lambda f: f(1), [lambda x, i=i: x + i for i in range(3)])

i=i will make a local variable i within the lambda so that
each lambda will refer to their own i instead of sharing the
same i from the outer scope.
From: SB
Subject: Re: Python is not [yet] Considered Harmful
Date: 
Message-ID: <24fd6f98.0310310023.202e10bf@posting.google.com>
This post is interesting, and raise an issue (unfortunately already
known) about scopes in Python. But bad faiths occurs when the poster
forget that :

1) variable capture is not an error, it can be linked with some topics
of computer science in one hand, and well known and considered useful
programming construction in the other hand (say, genuine exceptions).
Old timer's LISP used dynamic contexts, and has not been reported as
causing brain damage (AFAIK).

2) Now, a little bad faith from my own... Could you imagine the number
of people suffering this kind of brain damage (caused by the heavy use
of monads), which goes around explaining to people that imperative
programming is useless, and that only them knows the truth ??? You
seem to be part of them...

SB.
From: Thomas Stegen CES2000
Subject: Re: Python is not [yet] Considered Harmful
Date: 
Message-ID: <3f9d3963$1@nntphost.cis.strath.ac.uk>
·······@ziplip.com wrote:
> map(lambda f: f(1), [lambda x: x + 1 for i in range(3)])
> 
> Oh, OK, it was a typo (1 instead of i). I take it all back (for now).
> 
> It was an honest mistake, not a troll! 

Haha, and why is this posted to newsgroups dedicated
to languages completely unrelated to python?

You're a troll and I am feeding you. Your stupidity is however
large enough so it does not need to be pointed out really. I
won't be doing it again.

Ta-ta.

-- 
Thomas.