Commits

Stefan Krah committed e94aa30

Add parameter definitions to the cast() method.

Comments (0)

Files changed (1)

Doc/library/stdtypes.rst

 
       .. versionadded:: 3.2
 
-   .. method:: cast()
-
-      Cast a memoryview to a new format or shape. The return value is
-      a new memoryview, but the buffer itself is not copied. Supported
-      casts are 1D -> C-contiguous and C-contiguous -> 1D. One of the
-      formats must be a byte format ('B', 'b' or 'c'). The byte length
-      of the result must be the same as the original length.
+   .. method:: cast(format[, shape])
+
+      Cast a memoryview to a new format or shape. *shape* defaults to
+      ``[byte_length//new_itemsize]``, which means that the result view
+      will be one-dimensional. The return value is a new memoryview, but
+      the buffer itself is not copied. Supported casts are 1D -> C-contiguous
+      and C-contiguous -> 1D. One of the formats must be a byte format
+      ('B', 'b' or 'c'). The byte length of the result must be the same
+      as the original length.
 
       Cast 1D/long to 1D/unsigned bytes::