From cfd553dad7c1f315b7508eb56ac4527afc444ebb Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Thu, 30 Apr 2020 19:50:44 -0500 Subject: ENH: Implement concatenate dtype and casting keyword arguments Unfortunately, the casting was not consistent and sometimes used force casting (axis=None) while normally same kind casting was used. This thus deprecates the `force_casting` corner case, so that casting has to be provided in the future. --- numpy/core/multiarray.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'numpy/core/multiarray.py') diff --git a/numpy/core/multiarray.py b/numpy/core/multiarray.py index 10325050d..540c0568f 100644 --- a/numpy/core/multiarray.py +++ b/numpy/core/multiarray.py @@ -141,9 +141,9 @@ def empty_like(prototype, dtype=None, order=None, subok=None, shape=None): @array_function_from_c_func_and_dispatcher(_multiarray_umath.concatenate) -def concatenate(arrays, axis=None, out=None): +def concatenate(arrays, axis=None, out=None, dtype=None, casting=None): """ - concatenate((a1, a2, ...), axis=0, out=None) + concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") Join a sequence of arrays along an existing axis. @@ -159,6 +159,16 @@ def concatenate(arrays, axis=None, out=None): If provided, the destination to place the result. The shape must be correct, matching that of what concatenate would have returned if no out argument were specified. + dtype : str or dtype + If provided, the destination array will have this dtype. Cannot be + provided together with `out`. + + ..versionadded:: 1.19.0 + + casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional + Controls what kind of data casting may occur. Defaults to 'same_kind'. + + ..versionadded:: 1.19.0 Returns ------- -- cgit v1.2.1