Skip to content

Commit c943291

Browse files
committed
MAINT: Remove partition and split-like functions from numpy.strings
- Temporary removal of these functions until their behavior has been discussed further.
1 parent bbcaf73 commit c943291

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

numpy/_core/defchararray.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424
from numpy._core import overrides
2525
from numpy.strings import *
2626
from numpy.strings import multiply as strings_multiply
27+
from numpy._core.strings import (
28+
_partition as partition,
29+
_rpartition as rpartition,
30+
_split as split,
31+
_rsplit as rsplit,
32+
_splitlines as splitlines,
33+
_join as join,
34+
)
2735

2836
__all__ = [
2937
'equal', 'not_equal', 'greater_equal', 'less_equal',

numpy/_core/strings.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,13 @@
5454
"zfill",
5555

5656
# _vec_string - Will gradually become ufuncs as well
57-
"mod", "decode", "encode", "upper", "lower", "swapcase", "capitalize",
58-
"title", "join", "split", "rsplit", "splitlines", "partition",
59-
"rpartition", "translate",
57+
"upper", "lower", "swapcase", "capitalize", "title",
58+
59+
# _vec_string - Will probably not become ufuncs
60+
"mod", "decode", "encode", "translate",
61+
62+
# Removed from namespace until behavior has been crystalized
63+
# "join", "split", "rsplit", "splitlines", "partition", "rpartition",
6064
]
6165

6266

@@ -1145,7 +1149,7 @@ def replace(a, old, new, count=-1):
11451149
return _replace(arr, old, new, counts, out=out)
11461150

11471151

1148-
def join(sep, seq):
1152+
def _join(sep, seq):
11491153
"""
11501154
Return a string which is the concatenation of the strings in the
11511155
sequence `seq`.
@@ -1179,7 +1183,7 @@ def join(sep, seq):
11791183
_vec_string(sep, np.object_, 'join', (seq,)), seq)
11801184

11811185

1182-
def split(a, sep=None, maxsplit=None):
1186+
def _split(a, sep=None, maxsplit=None):
11831187
"""
11841188
For each element in `a`, return a list of the words in the
11851189
string, using `sep` as the delimiter string.
@@ -1222,7 +1226,7 @@ def split(a, sep=None, maxsplit=None):
12221226
a, np.object_, 'split', [sep] + _clean_args(maxsplit))
12231227

12241228

1225-
def rsplit(a, sep=None, maxsplit=None):
1229+
def _rsplit(a, sep=None, maxsplit=None):
12261230
"""
12271231
For each element in `a`, return a list of the words in the
12281232
string, using `sep` as the delimiter string.
@@ -1265,7 +1269,7 @@ def rsplit(a, sep=None, maxsplit=None):
12651269
a, np.object_, 'rsplit', [sep] + _clean_args(maxsplit))
12661270

12671271

1268-
def splitlines(a, keepends=None):
1272+
def _splitlines(a, keepends=None):
12691273
"""
12701274
For each element in `a`, return a list of the lines in the
12711275
element, breaking at line boundaries.
@@ -1294,7 +1298,7 @@ def splitlines(a, keepends=None):
12941298
a, np.object_, 'splitlines', _clean_args(keepends))
12951299

12961300

1297-
def partition(a, sep):
1301+
def _partition(a, sep):
12981302
"""
12991303
Partition each element in `a` around `sep`.
13001304
@@ -1335,7 +1339,7 @@ def partition(a, sep):
13351339
_vec_string(a, np.object_, 'partition', (sep,)), a)
13361340

13371341

1338-
def rpartition(a, sep):
1342+
def _rpartition(a, sep):
13391343
"""
13401344
Partition (split) each element around the right-most separator.
13411345

0 commit comments

Comments
 (0)