diff --git a/docs/src/quickstart/cythonize.rst b/docs/src/quickstart/cythonize.rst index 5d5f57f004bdb514be1f9dab682b37b14c897a26..cc0b8cc113b21a78a0a0ecc92495ed2b56960b4c 100644 --- a/docs/src/quickstart/cythonize.rst +++ b/docs/src/quickstart/cythonize.rst @@ -137,8 +137,9 @@ in general, a ``nogil`` block may contain only "white" code. .. figure:: htmlreport.png -Note that Cython deduces the type of local variables based on their assignments, -which can also cut down on the need to explicitly specify types everywhere. +Note that Cython deduces the type of local variables based on their assignments +(including as loop variable targets) which can also cut down on the need to +explicitly specify types everywhere. For example, declaring ``dx`` to be of type double above is unnecessary, as is declaring the type of ``s`` in the last version (where the return type of ``f`` is known to be a C double.) A notable exception, however, is diff --git a/docs/src/reference/compilation.rst b/docs/src/reference/compilation.rst index e2f3143903cb0c2bb62b83d281c367518d5f7971..29c24f6ba7166fb9c691a5cc51abdb7710083d09 100644 --- a/docs/src/reference/compilation.rst +++ b/docs/src/reference/compilation.rst @@ -397,6 +397,9 @@ Cython code. Here is the list of currently supported directives: Infer types of untyped variables in function bodies. Default is None, indicating that only safe (semantically-unchanging) inferences are allowed. + In particular, inferring *integral* types for variables *used in arithmetic + expressions* is considered unsafe (due to possible overflow) and must be + explicitly requested. ``language_level`` (2/3) Globally set the Python language level to be used for module diff --git a/docs/src/userguide/wrapping_CPlusPlus.rst b/docs/src/userguide/wrapping_CPlusPlus.rst index 239ffd3c2928e551be7a219677616fe6fa309b97..5d39fa5267c2a2884d9d72d20b0f9039c7750edd 100644 --- a/docs/src/userguide/wrapping_CPlusPlus.rst +++ b/docs/src/userguide/wrapping_CPlusPlus.rst @@ -510,6 +510,9 @@ comprehensions). For example, one can write:: f(value) return [x*x for x in v if x % 2 == 0] +If the loop target variable is unspecified, an assignment from type +``*container.begin()`` is used for :ref:`type inference <compiler-directives>`. + Simplified wrapping with default constructor --------------------------------------------