Skip to content

Instantly share code, notes, and snippets.

@ashchristopher
Created April 23, 2014 14:41
Show Gist options
  • Save ashchristopher/11217969 to your computer and use it in GitHub Desktop.
Save ashchristopher/11217969 to your computer and use it in GitHub Desktop.
Simple monkeypatch example.
In [1]: def monkey_patch():
...: return u"This is a monkey patch!"
...:
In [2]: import uuid
In [3]: print uuid.uuid4()
dda44145-8555-44c8-a9eb-e7337ee94437
In [4]: uuid.uuid4 = monkey_patch
In [5]: print uuid.uuid4()
This is a monkey patch!
In [6]: print uuid.uuid4()
This is a monkey patch!
In [7]: print uuid.uuid4()
This is a monkey patch!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment