Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import contextlib
- @contextlib.contextmanager
- def make_context(name):
- print 'entering:', name
- yield name
- print 'exiting :', name
- with contextlib.nested(make_context('A'),
- make_context('B')) as (A, B):
- print 'inside with statement:', A, B
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement