31.03.20 00:27, Jimmy Thrasibule пише:
In my situation, I would like to mix the `with` statement with `else`.
In this case I would like that if no exception is raised within the
`with` to run the `else` part.
It is easy. You do not need "else".
with my_context():
do_something_sensitive()
print("We're all safe.")
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/M7HVLCGQ6REMHKGZVZPIYTJGLN6WKN5F/
Code of Conduct: http://python.org/psf/codeofconduct/