Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:
What does it mean for two Bytecode objects to be equal? I know what equality means for ints: they have the same numeric value. I know what equality means for strings: they have the same sequence of Unicode code points. I have no concept of what it would mean for two Bytecode objects to be equal or unequal. Your patch compares the tuple: (codeobj, first_line, current_offset) but why do you compare those rather than, say, the source code, or the disassembled byte code, or something else? Before I read your patch, I guested that you would have defined `__eq__` as `self.dis() == other.dis()`. ---------- nosy: +steven.daprano _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39902> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com