Armin Rigo avatar Armin Rigo committed 91d651f

Document

Comments (0)

Files changed (1)

doc/source/index.rst

 |               | anything on which      | precision `(***)`|                |
 |               | float() works          |                  |                |
 +---------------+------------------------+------------------+----------------+
-|  pointers     | another <cdata> with   | a <cdata>        | ``[]``, ``+``, |
-|               | a compatible type (i.e.|                  | ``-``, bool()  |
-|               | same type or ``char*`` |                  |                |
+|  pointers     | another <cdata> with   | a <cdata>        |``[]`` `(****)`,|
+|               | a compatible type (i.e.|                  |``+``, ``-``,   |
+|               | same type or ``char*`` |                  |bool()          |
 |               | or ``void*``, or as an |                  |                |
 |               | array instead) `(*)`   |                  |                |
 +---------------+------------------------+                  |                |
 | function      | same as pointers       |                  | bool(),        |
 | pointers      |                        |                  | call `(**)`    |
 +---------------+------------------------+------------------+----------------+
-|  arrays       | a list or tuple of     | a <cdata>        | len(), iter(), |
-|               | items                  |                  | ``[]``,        |
-|               |                        |                  | ``+``, ``-``   |
+|  arrays       | a list or tuple of     | a <cdata>        |len(), iter(),  |
+|               | items                  |                  |``[]`` `(****)`,|
+|               |                        |                  |``+``, ``-``    |
 +---------------+------------------------+                  +----------------+
 |  ``char[]``   | same as arrays, or a   |                  | len(), iter(), |
 |               | Python string          |                  | ``[]``, ``+``, |
    without any precision loss, you need to define and use a family of C
    functions like ``long double add(long double a, long double b);``.
 
+.. versionadded:: 0.6
+   `(****)` Supports simple slices as well: ``x[start:stop]`` gives another
+   cdata object that is a "view" of all items from ``start`` to ``stop``.
+   It is a cdata of type "array" (so e.g. passing it as an argument to a
+   C function would just convert it to a pointer to the ``start`` item).
+   As with indexing, negative bounds mean really negative indices, like in
+   C.  As for slice assignment, it accepts any iterable, including a list
+   of items or another array-like cdata object, but the length must match.
+
 
 Reference: verifier
 -------------------
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.