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

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -