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.

Before really understanding what you need here I have some questions:

1) What does real-world code look like here exactly?
2) Why do you need foo to be deleted after the if?
3) Do you need this in interactive sessions, short-lived code or maintained code?


Cheers,
Sven
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to