In article ,
namekuseijin wrote:
>
>I don't like *for* at all. It both makes it tough to get true closures
>and also unnecessarily pollutes the namespace with non-local variables.
Maybe. Consider this standard Python idiom:
for x in L:
if x == criterion:
break
doSomething(x)
Obv
The real issue here has nothing to do with closures, lexical capture or
anything like that. It's a long known issue called side-effects.
Trying to program in a functional style in the presence of side-effects
is bad. *for* is the main perpetrator of side-effects here, because it
updates its
On Wed, Apr 22, 2009 at 3:32 PM, Benjamin Peterson wrote:
> Chris Rebert rebertia.com> writes:
>> Common wart to run into as of late. fn (in the lambda) doesn't get
>> evaluated until the call-time of the lambda, by which point the loop
>> has finished and the loop variable has been changed to it
Chris Rebert rebertia.com> writes:
> Common wart to run into as of late. fn (in the lambda) doesn't get
> evaluated until the call-time of the lambda, by which point the loop
> has finished and the loop variable has been changed to its final
> value, which is used by the lambda.
How is that a war
Dave Angel wrote:
... Incidentally, in your example, I believe you needed the *y and **z in
the actual parameters to __callFn__()
Also, use a name like __callFn rhather than __callFn__ -- You are
treading on Pythons internal names if you put __ at the beginning
_and_ the end, and will con
Rüdiger Ranft wrote:
> Hi all,
>
> I want to generate some methods in a class using setattr and lambda.
> Within each generated function a name parameter to the function is
> replaced by a string constant, to keep trail which function was called.
> The problem I have is, that the substituted name
Rüdiger Ranft wrote:
Hi all,
I want to generate some methods in a class using setattr and lambda.
Within each generated function a name parameter to the function is
replaced by a string constant, to keep trail which function was called.
The problem I have is, that the substituted name parameter
Chris Rebert schrieb:
> On Wed, Apr 22, 2009 at 4:50 AM, Rüdiger Ranft <_r...@web.de> wrote:
>> Hi all,
>>
>> I want to generate some methods in a class using setattr and lambda.
>> Within each generated function a name parameter to the function is
>> replaced by a string constant, to keep trail wh
On Wed, Apr 22, 2009 at 4:50 AM, Rüdiger Ranft <_r...@web.de> wrote:
> Hi all,
>
> I want to generate some methods in a class using setattr and lambda.
> Within each generated function a name parameter to the function is
> replaced by a string constant, to keep trail which function was called.
> Th