Skip to content

Instantly share code, notes, and snippets.

@zhusimaji
Created August 11, 2017 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhusimaji/0dd5cd4bc96d52f62da2a029f841b326 to your computer and use it in GitHub Desktop.
Save zhusimaji/0dd5cd4bc96d52f62da2a029f841b326 to your computer and use it in GitHub Desktop.
v2ex11
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