Last active
August 29, 2015 14:20
-
-
Save sincerefly/4259cdfe73a9043e6256 to your computer and use it in GitHub Desktop.
python的__builtins__使用,修改了sum函数,使得sum接受sum(1, 2, 3)这样的使用方式
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
def sum(*args): | |
return __builtins__.sum(filter(lambda x: type(x) == int, args)) | |
print sum(1, 2, 3) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment