Serhiy Storchaka added the comment: First, few comments about the code.
1) The condition "a == b" is enough. No need to test "PyDict_CheckExact(a)" and like. 2) This fast path can be used only for Py_EQ and Py_NE. For other operations it can change the behavior. This is common approach of implementing operator== on C++. Unless comparing objects is trivial the implementation of operator== almost always starts with comparing pointers. In Python the overhead of calling methods and comparing objects is larger than in C++ and I expect that the relative overhead of one additional pointer comparison is smaller. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30907> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com