Quick search

Compatibility module for Python 2.7 and > 3.3

This module provides a set of utility types and functions for optimization and to aid in writing Python 2/3 compatibile code.

kivy.compat.PY2 = False

True if this version of python is 2.x.

kivy.compat.clock() → float

A clock with the highest available resolution on your current Operating System.

kivy.compat.string_types

A utility type for detecting string in a Python 2/3 friendly way. For example:

if isinstance(s, string_types):
    print("It's a string or unicode type")
else:
    print("It's something else.")

str のエイリアス

kivy.compat.isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0) → bool

Determine whether two floating point numbers are close in value.

rel_tol
maximum difference for being considered “close”, relative to the magnitude of the input values
abs_tol
maximum difference for being considered “close”, regardless of the magnitude of the input values

Return True if a is close in value to b, and False otherwise.

For the values to be considered close, the difference between them must be smaller than at least one of the tolerances.

-inf, inf and NaN behave similarly to the IEEE 754 Standard. That is, NaN is not close to anything, even itself. inf and -inf are only close to themselves.