Skip to content

Instantly share code, notes, and snippets.

@Zheaoli
Created February 24, 2018 18:27
Show Gist options
  • Save Zheaoli/ab897e9fe58c1370760b4c1478bb4f70 to your computer and use it in GitHub Desktop.
Save Zheaoli/ab897e9fe58c1370760b4c1478bb4f70 to your computer and use it in GitHub Desktop.
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