Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Some:
- def __enter__(self):
- print("Entering context")
- return self
- def __exit__(self, type, value, traceback):
- print("Exiting context")
- def foo(self):
- print("Foo!!!!")
- with Some() as s:
- print("Hello, World!")
- s.foo()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement