Created
February 24, 2018 18:27
-
-
Save Zheaoli/ab897e9fe58c1370760b4c1478bb4f70 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 operator | |
class ABC(): | |
def __init__(self,value=0): | |
self.value=value | |
def __iadd__(self,y): | |
print(y) | |
self.value+=y | |
a=ABC() | |
def func3(): | |
print(a.value,id(a)) | |
operator.iadd(a,1) | |
print(a.value,id(a)) | |
func3() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment