Skip to content

Commit

Permalink
Merge pull request numpy#20061 from DimitriPapadopoulos/python3
Browse files Browse the repository at this point in the history
DOC: Remove references to Python 2
  • Loading branch information
mattip authored Oct 10, 2021
2 parents a0d0805 + 5dc744e commit cc545bf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 32 deletions.
30 changes: 3 additions & 27 deletions numpy/core/code_generators/ufunc_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,9 +1091,7 @@ def add_newdoc(place, name, doc):
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
--------
Expand All @@ -1106,27 +1104,6 @@ def add_newdoc(place, name, doc):
[ 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
Expand Down Expand Up @@ -4038,9 +4015,8 @@ def add_newdoc(place, name, doc):
"""
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
----------
Expand Down
3 changes: 0 additions & 3 deletions numpy/distutils/ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 1 addition & 2 deletions numpy/lib/_iotools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit cc545bf

Please sign in to comment.