How does python compare functions?

Function objects do not define their own comparisons or rich comparisons. Instead, they inherit from type objects which implement rich comparisons based on the object’s address in memory.

So yes, it effectively uses addresses just like the built-in id() function does.

In Python 3, functions are no longer orderable.

Leave a Comment