Re: Inline Calculation of Dictionary Values

2010-04-21 Thread Peter Otten
Dave Angel wrote: > ++imanshu wrote: >> Hi, >> >> Is it possible to something along these lines in python :- >> >> map = { >> 'key1': f(), >> 'key2': modify_state(); val = f(); restore_state(); val, >> 'key3': f(), >> } >> >> For 'key2' I want to store the value returned by f() but afte

Re: Inline Calculation of Dictionary Values

2010-04-21 Thread ++imanshu
On Apr 21, 6:10 pm, Chris Rebert wrote: > On Wed, Apr 21, 2010 at 5:51 AM, ++imanshu wrote: > >     Is it possible to something along these lines in python :- > > > map = { > > 'key1': f(), > > 'key2': modify_state(); val = f(); restore_state(); val, > > 'key3': f(), > > } > > >      For 'key2' I

Re: Inline Calculation of Dictionary Values

2010-04-21 Thread ++imanshu
On Apr 21, 7:31 pm, Dave Angel wrote: > ++imanshu wrote: > > Hi, > > >      Is it possible to something along these lines in python :- > > > map = { > > 'key1': f(), > > 'key2': modify_state(); val = f(); restore_state(); val, > > 'key3': f(), > > } > > >       For 'key2' I want to store the value

Re: Inline Calculation of Dictionary Values

2010-04-21 Thread Dave Angel
++imanshu wrote: Hi, Is it possible to something along these lines in python :- map = { 'key1': f(), 'key2': modify_state(); val = f(); restore_state(); val, 'key3': f(), } For 'key2' I want to store the value returned by f() but after modifying the state. Do we have something like

Re: Inline Calculation of Dictionary Values

2010-04-21 Thread Chris Rebert
On Wed, Apr 21, 2010 at 5:51 AM, ++imanshu wrote: >     Is it possible to something along these lines in python :- > > map = { > 'key1': f(), > 'key2': modify_state(); val = f(); restore_state(); val, > 'key3': f(), > } > >      For 'key2' I want to store the value returned by f() but after > modi

Inline Calculation of Dictionary Values

2010-04-21 Thread ++imanshu
Hi, Is it possible to something along these lines in python :- map = { 'key1': f(), 'key2': modify_state(); val = f(); restore_state(); val, 'key3': f(), } For 'key2' I want to store the value returned by f() but after modifying the state. Do we have something like a "bare block". I a