|
807 | 807 | a default ``dtype`` that can represent the values (by applying promotion |
808 | 808 | rules when necessary.) |
809 | 809 | copy : bool, optional |
810 | | - Iftrue (default), then the array data is copied.Otherwise, a copy |
811 | | - will only be made if ``__array__`` returns a copy, if obj is a nested |
812 | | - sequence, or if a copy is needed to satisfy any of the other |
| 810 | + If``True`` (default), then the array data is copied.If ``None``, |
| 811 | +a copywill only be made if ``__array__`` returns a copy, if obj is |
| 812 | +a nestedsequence, or if a copy is needed to satisfy any of the other |
813 | 813 | requirements (``dtype``, ``order``, etc.). Note that any copy of |
814 | 814 | the data is shallow, i.e., for arrays with object dtype, the new |
815 | 815 | array will point to the same objects. See Examples for `ndarray.copy`. |
| 816 | + For ``False`` it raises a ``ValueError`` if a copy cannot be avoided. |
| 817 | + Default: ``True``. |
816 | 818 | order : {'K', 'A', 'C', 'F'}, optional |
817 | 819 | Specify the memory layout of the array. If object is not an array, the |
818 | 820 | newly created array will be in C order (row major) unless 'F' is |
|
828 | 830 | 'F' F order F order |
829 | 831 | ===== ========= =================================================== |
830 | 832 |
|
831 | | - When ``copy=False`` and a copy is made for other reasons, the result is |
| 833 | + When ``copy=None`` and a copy is made for other reasons, the result is |
832 | 834 | the same as if ``copy=True``, with some exceptions for 'A', see the |
833 | 835 | Notes section. The default order is 'K'. |
834 | 836 | subok : bool, optional |
|
915 | 917 |
|
916 | 918 | add_newdoc('numpy._core.multiarray','asarray', |
917 | 919 | """ |
918 | | - asarray(a, dtype=None, order=None, *, device=None, like=None) |
| 920 | + asarray(a, dtype=None, order=None, *, device=None,copy=None,like=None) |
919 | 921 |
|
920 | 922 | Convert the input to an array. |
921 | 923 |
|
|
939 | 941 | For Array-API interoperability only, so must be ``"cpu"`` if passed. |
940 | 942 |
|
941 | 943 | .. versionadded:: 2.0.0 |
| 944 | + copy : bool, optional |
| 945 | + If ``True``, then the object is copied. If ``None`` then the object is |
| 946 | + copied only if needed, i.e. if ``__array__`` returns a copy, if obj |
| 947 | + is a nested sequence, or if a copy is needed to satisfy any of |
| 948 | + the other requirements (``dtype``, ``order``, etc.). |
| 949 | + For ``False`` it raises a ``ValueError`` if a copy cannot be avoided. |
| 950 | + Default: ``None``. |
942 | 951 | ${ARRAY_FUNCTION_LIKE} |
943 | 952 |
|
944 | 953 | .. versionadded:: 1.20.0 |
|
2934 | 2943 |
|
2935 | 2944 | add_newdoc('numpy._core.multiarray','ndarray', ('__array__', |
2936 | 2945 | """ |
2937 | | - a.__array__([dtype], /) |
| 2946 | + a.__array__([dtype], /, *, copy=None) |
2938 | 2947 |
|
2939 | | - Returns either a new reference to self if dtype is not given or a new array |
2940 | | - of provided data type if dtype is different from the current dtype of the |
2941 | | - array. |
| 2948 | + For ``dtype`` parameter it returns either a new reference to self if |
| 2949 | + ``dtype`` is not given or a new array of provided data type if ``dtype`` |
| 2950 | + is different from the current data type of the array. |
| 2951 | + For ``copy`` parameter it returns a new reference to self if |
| 2952 | + ``copy=False`` or ``copy=None`` and copying isn't enforced by ``dtype`` |
| 2953 | + parameter. The method returns a new array for ``copy=True``, regardless of |
| 2954 | + ``dtype`` parameter. |
2942 | 2955 |
|
2943 | 2956 | """)) |
2944 | 2957 |
|
|