#!/home/songxinkai/anaconda3/bin/python

from contextlib import contextmanager

class cls0:
    def __init__(self):
        self.f = -1
    def __enter__(self):
        print ("enter")
        self.f = 2
        return self
    def __exit__(self, exc_type, exc_value, traceback):
        print ("exit")
        return True

if __name__ == "__main__":
    with cls0() as t:
        print (t.f)
