On 18.10.2016 00:11, Michael duPont wrote:
What does everyone think 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.
It was not my intention to declare those to be similar, just as a
furthering train of thought. I agree that using "as" is a much more
Pythonic syntax. I'm sure there was (and will be) some discussion as to
whether it should operate like "if foo:" or "if foo is not None:". I'll
look a bit further