Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Inline Calculation of Dictionary Values
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="++imanshu, post: 4061978"] 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 am trying to avoid this :- def f2(): modify_state() val = f() restore_state() return val map = { 'key1': f(), 'key2': f2() 'key3': f(), } Thank You, Himanshu [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Inline Calculation of Dictionary Values
Top