Files
intern2020/testgetattr.py
2021-01-11 18:45:03 +00:00

30 lines
509 B
Python

from contextlib import contextmanager
class A():
def b(self):
return "Hello"
@property
def cm(self):
@contextmanager
def stuff():
print("start")
try:
yield None
#yield 2
except Exception:
pass
print("end")
return stuff
def p(self):
with self.cm() as i:
print(f"{i} middle")
raise Exception
a=A()
a.p()