Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f76fa21

Browse filesBrowse files
eric-wiesertylerjereddy
authored andcommitted
DOC: Add release note
1 parent ed825fb commit f76fa21
Copy full SHA for f76fa21

File tree

Expand file treeCollapse file tree

2 files changed

+26
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+26
-1
lines changed

‎doc/release/1.17.0-notes.rst

Copy file name to clipboardExpand all lines: doc/release/1.17.0-notes.rst
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,31 @@ was accidental. The old behavior can be retained with
319319
``structured_to_unstructured(arr[['a']]).squeeze(axis=-1)`` or far more simply,
320320
``arr['a']``.
321321

322+
``clip`` now uses a ufunc under the hood
323+
----------------------------------------
324+
This means that registering clip functions for custom dtypes in C via
325+
`descr->f->fastclip` is deprecated - they should use the ufunc registration
326+
mechanism instead, attaching to the ``np.core.umath.clip`` ufunc.
327+
328+
It also means that ``clip`` accepts ``where`` and ``casting`` arguments,
329+
and can be override with ``__array_ufunc__``.
330+
331+
A consequence of this change is that some behaviors of the old ``clip`` have
332+
been deprecated:
333+
334+
* Passing ``nan`` to mean "do not clip" as one or both bounds. This didn't work
335+
in all cases anyway, and can be better handled by passing infinities of the
336+
appropriate sign.
337+
* Using "unsafe" casting by default when an ``out`` argument is passed. Using
338+
``casting="unsafe"`` explicitly will silence this warning.
339+
340+
Additionally, there are some corner cases with behavior changes:
341+
342+
* Padding ``max < min`` has changed to be more consistent across dtypes, but
343+
should not be relied upon.
344+
* Scalar ``min`` and ``max`` take part in promotion rules like they do in all
345+
other ufuncs.
346+
322347
``__array_interface__`` offset now works as documented
323348
------------------------------------------------------
324349
The interface may use an ``offset`` value that was mistakenly ignored.

‎numpy/core/_add_newdocs.py

Copy file name to clipboardExpand all lines: numpy/core/_add_newdocs.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2771,7 +2771,7 @@
27712771

27722772
add_newdoc('numpy.core.multiarray', 'ndarray', ('clip',
27732773
"""
2774-
a.clip(min=None, max=None, out=None)
2774+
a.clip(min=None, max=None, out=None, **kwargs)
27752775
27762776
Return an array whose values are limited to ``[min, max]``.
27772777
One of max or min must be given.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.