Skip to content

Commit 6f63230

Browse files
vnherdeiromdhaber
andauthored
DOC: np.vectorize: exclude both positional and keyword use of argument (numpy#27408)
* DOC: np.vectorize: exclude both positional and keyword use of argument --------- Co-authored-by: Matt Haberland <[email protected]>
1 parent a5cb327 commit 6f63230

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

numpy/lib/_function_base_impl.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,7 +2218,7 @@ class vectorize:
22182218
``pyfunc.__doc__``.
22192219
excluded : set, optional
22202220
Set of strings or integers representing the positional or keyword
2221-
arguments for which the function will not be vectorized. These will be
2221+
arguments for which the function will not be vectorized. These will be
22222222
passed directly to `pyfunc` unmodified.
22232223
22242224
cache : bool, optional
@@ -2305,15 +2305,15 @@ class vectorize:
23052305
... while _p:
23062306
... res = res*x + _p.pop(0)
23072307
... return res
2308-
>>> vpolyval = np.vectorize(mypolyval, excluded=['p'])
2309-
>>> vpolyval(p=[1, 2, 3], x=[0, 1])
2310-
array([3, 6])
23112308
2312-
Positional arguments may also be excluded by specifying their position:
2309+
Here, we exclude the zeroth argument from vectorization whether it is
2310+
passed by position or keyword.
23132311
2314-
>>> vpolyval.excluded.add(0)
2312+
>>> vpolyval = np.vectorize(mypolyval, excluded={0, 'p'})
23152313
>>> vpolyval([1, 2, 3], x=[0, 1])
23162314
array([3, 6])
2315+
>>> vpolyval(p=[1, 2, 3], x=[0, 1])
2316+
array([3, 6])
23172317
23182318
The `signature` argument allows for vectorizing functions that act on
23192319
non-scalar arrays of fixed length. For example, you can use it for a

0 commit comments

Comments
 (0)