Created
April 23, 2014 14:41
-
-
Save ashchristopher/11217969 to your computer and use it in GitHub Desktop.
Simple monkeypatch example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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