diff options
| author | Matti Picus <matti.picus@gmail.com> | 2021-10-10 10:29:41 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-10 10:29:41 +0300 |
| commit | cc545bfea39002a165f0d3401a5a2739317460c5 (patch) | |
| tree | 2e4754bcf0396c438e14de5c5ad3dc53f52fd68a | |
| parent | a0d0805545af0b683e960486b7036064fea084a4 (diff) | |
| parent | 5dc744e3adba84a9da1efd66cd9403cb03202d49 (diff) | |
| download | numpy-cc545bfea39002a165f0d3401a5a2739317460c5.tar.gz | |
Merge pull request #20061 from DimitriPapadopoulos/python3
DOC: Remove references to Python 2
| -rw-r--r-- | numpy/core/code_generators/ufunc_docstrings.py | 30 | ||||
| -rw-r--r-- | numpy/distutils/ccompiler.py | 3 | ||||
| -rw-r--r-- | numpy/lib/_iotools.py | 3 |
3 files changed, 4 insertions, 32 deletions
diff --git a/numpy/core/code_generators/ufunc_docstrings.py b/numpy/core/code_generators/ufunc_docstrings.py index c15e1f042..9ae9a24c0 100644 --- a/numpy/core/code_generators/ufunc_docstrings.py +++ b/numpy/core/code_generators/ufunc_docstrings.py @@ -1091,9 +1091,7 @@ add_newdoc('numpy.core.umath', 'divide', Behavior on division by zero can be changed using ``seterr``. - In Python 2, when both ``x1`` and ``x2`` are of an integer type, - ``divide`` will behave like ``floor_divide``. In Python 3, it behaves - like ``true_divide``. + Behaves like ``true_divide``. Examples -------- @@ -1106,27 +1104,6 @@ add_newdoc('numpy.core.umath', 'divide', [ Inf, 4. , 2.5], [ Inf, 7. , 4. ]]) - Note the behavior with integer types (Python 2 only): - - >>> np.divide(2, 4) - 0 - >>> np.divide(2, 4.) - 0.5 - - Division by zero always yields zero in integer arithmetic (again, - Python 2 only), and does not raise an exception or a warning: - - >>> np.divide(np.array([0, 1], dtype=int), np.array([0, 0], dtype=int)) - array([0, 0]) - - Division by zero can, however, be caught using ``seterr``: - - >>> old_err_state = np.seterr(divide='raise') - >>> np.divide(1, 0) - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - FloatingPointError: divide by zero encountered in divide - >>> ignored_states = np.seterr(**old_err_state) >>> np.divide(1, 0) 0 @@ -4038,9 +4015,8 @@ add_newdoc('numpy.core.umath', 'true_divide', """ Returns a true division of the inputs, element-wise. - Instead of the Python traditional 'floor division', this returns a true - division. True division adjusts the output type to present the best - answer, regardless of input types. + Unlike 'floor division', true division adjusts the output type + to present the best answer, regardless of input types. Parameters ---------- diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py index 6d063ee4e..4495c8fee 100644 --- a/numpy/distutils/ccompiler.py +++ b/numpy/distutils/ccompiler.py @@ -258,9 +258,6 @@ def CCompiler_compile(self, sources, output_dir=None, macros=None, If compilation fails. """ - # This method is effective only with Python >=2.3 distutils. - # Any changes here should be applied also to fcompiler.compile - # method to support pre Python 2.3 distutils. global _job_semaphore jobs = get_num_build_jobs() diff --git a/numpy/lib/_iotools.py b/numpy/lib/_iotools.py index a576925d6..4a5ac1285 100644 --- a/numpy/lib/_iotools.py +++ b/numpy/lib/_iotools.py @@ -23,8 +23,7 @@ def _decode_line(line, encoding=None): Returns ------- - decoded_line : unicode - Unicode in Python 2, a str (unicode) in Python 3. + decoded_line : str """ if type(line) is bytes: |
