Last active
August 29, 2015 14:25
-
-
Save dbbbit/0a7ebaa708d0d6c7fc36 to your computer and use it in GitHub Desktop.
This file contains 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
from origin import A | |
A.p = "test" |
This file contains 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
class A: | |
@classmethod | |
def p(cls): | |
return "hello" |
This file contains 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
import monkey | |
from origin import A | |
# 需要保持 A.p 为原来的函数 | |
print A.p() | |
# 需要保证 patch 只在 monkey 模块生效 | |
print monkey.A.p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment