Created
October 11, 2016 12:17
-
-
Save ruoyu0088/d385f3ca04583c481538751f50adc364 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
import gc | |
def set_class_dict(klass, key, value): | |
import gc | |
d = gc.get_referents(klass.__dict__)[0] | |
d[key] = value | |
set_class_dict(str, "toint", lambda self:int(self)) | |
print("123".toint()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如何传递参数呢? 比如我想把 center 函数变成 "居中", 该怎么做呢?