You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
254 B
14 lines
254 B
class CtxMgr:
|
|
|
|
def __enter__(self):
|
|
print("__enter__")
|
|
return self
|
|
|
|
def __exit__(self, a, b, c):
|
|
print("__exit__", repr(a), repr(b))
|
|
|
|
for i in range(5):
|
|
print(i)
|
|
with CtxMgr():
|
|
if i == 3:
|
|
break
|
|
|