[Python-ideas] Conditional Assignment in If Statement

2016-10-17 Thread Michael duPont
about: if foo = get_foo(): bar(foo) as a means to replace: foo = get_foo() if not foo: bar(foo) del foo Might there be some better syntax or a different keyword? I constantly run into this sort of use case. Michael duPont ___ Python-ideas

Re: [Python-ideas] Conditional Assignment in If Statement

2016-10-17 Thread Michael duPont
one:". I'll look a bit further into the archives than I did to find previous discussions. For now, I'm a fan of: if get_foo() as foo: bar(foo) to replace the "if foo:" version: foo = get_foo() if foo: bar(foo) del foo On Mon, Oct 17, 2016 at 6:18 PM Chris Angel