human
I am working on the file "20170913_python_decorator_contextmanager/decorator_and_contextmanager.ipynb".
The first task is:
Context manager
Basic concept
所謂 context 就是上下文的意思, 跟 decorator 同樣的地方是他可以在執行跟結束 function 的時候有額外操作
Can you write Python code for it?
 ... Can you provide a the Python code you requested?
assistant
#Here is the Python code you requested.

class my_context(object):
    def __enter__(self):
        print('in enter')
        return 'enter'
    def __exit__(self, *excinfo):
        print('in exit')
        return 'exit'

with my_context() as f:
    print('Hello')
    print('World')