#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 11 13:48:42 2021

@author: peter
"""

from contextlib import contextmanager

@contextmanager
def just_a_function():
    print('Context manager created')
    yield
    print('Context manager destroyed')
    
with just_a_function():
    print('Run operations')
59d6be886e129b70b5f24cb51bc80ab0e3d01a05
<mask token>

<mask token>


@contextmanager
def just_a_function():
    print('Context manager created')
    yield
    print('Context manager destroyed')


<mask token>

<mask token>


@contextmanager
def just_a_function():
    print('Context manager created')
    yield
    print('Context manager destroyed')


with just_a_function():
    print('Run operations')

<mask token>
from contextlib import contextmanager


@contextmanager
def just_a_function():
    print('Context manager created')
    yield
    print('Context manager destroyed')


with just_a_function():
    print('Run operations')

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 11 13:48:42 2021

@author: peter
"""

from contextlib import contextmanager

@contextmanager
def just_a_function():
    print('Context manager created')
    yield
    print('Context manager destroyed')
    
with just_a_function():
    print('Run operations')