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
Post a Comment