Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products.

Python 3.10 is now available in preview.

Module: google.appengine.api.cmp_compat

Helpers providing a bridge between the Python 2 __cmp__ and Python 3.

Python 2 uses methods called __cmp__ to override object comparison behavior; in Python 3 __cmp__ is replaced by rich comparison functions.

Additionally, Python 2 allows code to compare objects of different types, falling back to lexographical class-name comparisons if types are different (so instance of "int" are always less than instances of "str").

This file offers some utilities to bridge the gap between Python 2 and 3.

Functions

cmp(...): Emulate Python 2 cmp in Python 3.

total_ordering_from_cmp(...): Class decorator that fills in missing ordering methods from __cmp__.