8000 py: code: add __eq__ and __ne__ methods · go-python/gpython@8f4bd41 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8f4bd41

Browse files
committed
py: code: add __eq__ and __ne__ methods
1 parent 99c3f74 commit 8f4bd41

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

py/code.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,19 @@ func (co *Code) Addr2Line(addrq int32) int32 {
229229
}
230230
return line
231231
}
232+
233+
// FIXME this should be the default?
234+
func (co *Code) M__eq__(other Object) Object {
235+
if otherCo, ok := other.(*Code); ok && co == otherCo {
236+
return True
237+
}
238+
return False
239+
}
240+
241+
// FIXME this should be the default?
242+
func (co *Code) M__ne__(other Object) Object {
243+
if otherCo, ok := other.(*Code); ok && co == otherCo {
244+
return False
245+
}
246+
return True
247+
}

0 commit comments

Comments
 (0)
0