Using Context Manager
with cm_for_sample():
start
do
do
if we are done early:
return early-end
do
bad-code (raises exception)
do
cleanup
happens automatically, it is defined inside thecm_for_sample
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
with cm_for_sample():
start
do
do
if we are done early:
return early-end
do
bad-code (raises exception)
do
cleanup
happens automatically, it is defined inside the cm_for_sample