Re: [python-nl] lambda rewrite question

2011-06-30 Berichten over hetzelfde onderwerp Elit
Hi, I think the problem is that the lamba function tries to return the value stored at variable 'c', but that variable is only defined within the inner loop. So, if the lambda function gets called later on, it references 'c' which is not valid anymore. You might be able to solve it by doing

Re: [python-nl] lambda rewrite question

2011-06-29 Berichten over hetzelfde onderwerp Floris van Manen
On Jun 29, 2011, at 21:03, Dirkjan Ochtman wrote: > 2011/6/29 Floris van Manen : >> Exactement ... >> En python zelf is ook niet helemaal 100% autochtoon, qua syntax en alles :-) > > Nouja, de syntax zelf is vrij taalneutraal... ;) ( try if def while else not except ) autochtoon in de zin van e

Re: [python-nl] lambda rewrite question

2011-06-29 Berichten over hetzelfde onderwerp Dirkjan Ochtman
2011/6/29 Floris van Manen : > Exactement ... > En python zelf is ook niet helemaal 100% autochtoon, qua syntax en alles :-) Nouja, de syntax zelf is vrij taalneutraal... ;) Groet, Dirkjan ___ Python-nl mailing list Python-nl@python.org http://mail.pyt

Re: [python-nl] lambda rewrite question

2011-06-29 Berichten over hetzelfde onderwerp Floris van Manen
On Jun 29, 2011, at 17:51, Sylvain Viollon wrote: > On Wed, 29 Jun 2011 17:36:11 +0200 > Wichert Akkerman wrote: > >> On 06/29/2011 05:35 PM, Kit BLAKE wrote: >>> On 29 Jun 2011, at 16:44, Wichert Akkerman wrote: (zullen we python-nl gewoon in het nederlands houden?) >>> >>> Hij is een Fr

Re: [python-nl] lambda rewrite question

2011-06-29 Berichten over hetzelfde onderwerp Remco Wendt
2011/6/29 Sylvain Viollon > En de vraag was in engels. > Gaat al de goede kant op Sylvain! Het is alleen: de vraag was in _het_ Engels. Groetjes, Remco -- Maykin Media Herengracht 416, 1017 BZ Amsterdam tel.: +31 (0)20 753 05 23 mob.: +31 (0)6 187 967 06 http://www.maykinmedia.nl

Re: [python-nl] lambda rewrite question

2011-06-29 Berichten over hetzelfde onderwerp Rob Hooft
2011/6/29 Floris van Manen : > For those of you who know everything about the basic python syntax & > semantics ... > I get stuck in a simple context issue (i think) > > > this version works, it return the stored float value > > def rewrite( d ): >    for key in d: >        for k in d[key]['next']

Re: [python-nl] lambda rewrite question

2011-06-29 Berichten over hetzelfde onderwerp Sylvain Viollon
On Wed, 29 Jun 2011 17:36:11 +0200 Wichert Akkerman wrote: > On 06/29/2011 05:35 PM, Kit BLAKE wrote: > > On 29 Jun 2011, at 16:44, Wichert Akkerman wrote: > >> (zullen we python-nl gewoon in het nederlands houden?) > > > > Hij is een Fransman. (Maar toch bezig met een cursus nederlands :) > > P

Re: [python-nl] lambda rewrite question

2011-06-29 Berichten over hetzelfde onderwerp Floris van Manen
On Jun 29, 2011, at 16:44, Wichert Akkerman wrote: > Als workaround kan je dit herschrijven als "lambda x=c: x" Dat is ook weer wel zo duidelijk. .F ___ Python-nl mailing list Python-nl@python.org http://mail.python.org/mailman/listinfo/python-nl

Re: [python-nl] lambda rewrite question

2011-06-29 Berichten over hetzelfde onderwerp Wichert Akkerman
On 06/29/2011 05:35 PM, Kit BLAKE wrote: On 29 Jun 2011, at 16:44, Wichert Akkerman wrote: (zullen we python-nl gewoon in het nederlands houden?) Hij is een Fransman. (Maar toch bezig met een cursus nederlands :) Prima reden om hier nederlands te proberen dan! En anders is er vast python-fr

Re: [python-nl] lambda rewrite question

2011-06-29 Berichten over hetzelfde onderwerp Kit BLAKE
On 29 Jun 2011, at 16:44, Wichert Akkerman wrote: (zullen we python-nl gewoon in het nederlands houden?) Hij is een Fransman. (Maar toch bezig met een cursus nederlands :) Kit Als workaround kan je dit herschrijven als "lambda x=c: x" Wichert. _

Re: [python-nl] lambda rewrite question

2011-06-29 Berichten over hetzelfde onderwerp Wichert Akkerman
On 06/29/2011 04:30 PM, Sylvain Viollon wrote: On Wed, 29 Jun 2011 16:01:38 +0200 Floris van Manen wrote: Hello, this doesn't if i call the function it will return a (random?) identical value for all stored lambda functions. def rewrite( d ): for key in d: for k in d[key]['n

Re: [python-nl] lambda rewrite question

2011-06-29 Berichten over hetzelfde onderwerp Sylvain Viollon
On Wed, 29 Jun 2011 16:01:38 +0200 Floris van Manen wrote: Hello, > this doesn't > if i call the function it will return a (random?) identical value for > all stored lambda functions. > > def rewrite( d ): > for key in d: > for k in d[key]['next']: > c = float(d[key]['

Re: [python-nl] lambda rewrite question

2011-06-29 Berichten over hetzelfde onderwerp Tikitu de Jager -- Buzzcapture
There's a good StackOverflow answer on this: http://stackoverflow.com/questions/2295290/what-do-lambda-function-closures-capture-in-python The question is actually by my boss, but that's something of a coincidence: I found it with google then remembered that he had stumbled on the problem befo

[python-nl] lambda rewrite question

2011-06-29 Berichten over hetzelfde onderwerp Floris van Manen
For those of you who know everything about the basic python syntax & semantics ... I get stuck in a simple context issue (i think) this version works, it return the stored float value def rewrite( d ): for key in d: for k in d[key]['next']: c = float(d[key]['next'][k]['p