multiple changes
This commit is contained in:
@@ -1,6 +1,29 @@
|
||||
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()
|
||||
print(callable(getattr(a,"b")))
|
||||
print(getattr(a, "b")())
|
||||
|
||||
|
||||
a.p()
|
||||
|
||||
Reference in New Issue
Block a user