python - If expression variables inside if block -


this common idiom:

if foo.get("bar"):     bar = foo.get("bar")     # bar 

instead want like

if foo.get("bar") bar:     # bar 

is there way in python?

no, there not.

bar = foo.get('bar') if bar:    ... del bar 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

android - IBM Worklight 6.1 [Application Error] There was a network error (file:///android_asset/www/index.html) -