Skip to content

Instantly share code, notes, and snippets.

@weissjeffm
Created January 21, 2014 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weissjeffm/8543311 to your computer and use it in GitHub Desktop.
Save weissjeffm/8543311 to your computer and use it in GitHub Desktop.
contextmgr example
class Provider(object):
def __init__(self, x=None):
self.x = x
myprov = Provider(x=0)
with update(myprov) as updated:
updated.x = 1
updated.x
# 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment