Created
August 11, 2017 00:42
-
-
Save zhusimaji/0dd5cd4bc96d52f62da2a029f841b326 to your computer and use it in GitHub Desktop.
v2ex11
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 num: | |
def __init__(self,v): | |
self.v=v | |
def double(self): | |
return self.v*2 | |
x=num(2) | |
bound=x.double | |
print bound.__self__ | |
print bound.__self__.v | |
print bound() | |
输出 | |
<__main__.num instance at 0x102a71098> | |
2 | |
4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment