[Numpy-svn] r3555 - trunk/numpy/doc

numpy-svn@scip... numpy-svn@scip...
Tue Feb 27 19:16:02 CST 2007


Author: oliphant
Date: 2007-02-27 19:15:59 -0600 (Tue, 27 Feb 2007)
New Revision: 3555

Modified:
   trunk/numpy/doc/pep_buffer.txt
Log:
Update to buffer interface PEP

Modified: trunk/numpy/doc/pep_buffer.txt
===================================================================
--- trunk/numpy/doc/pep_buffer.txt	2007-02-28 01:09:01 UTC (rev 3554)
+++ trunk/numpy/doc/pep_buffer.txt	2007-02-28 01:15:59 UTC (rev 3555)
@@ -248,7 +248,7 @@
    'w' will return Python unicode.  Unpacking a multi-dimensional
    array will return a list of lists.  Un-packing a pointer will
    return a ctypes pointer object.  Un-packing a bit will return a
-   Python Bool.
+   Python Bool.  Spaces in the struct-string syntax will be ignored.
 
    Endian-specification ('=','>','<') is also allowed inside the
    string so that it can change if needed.  The previously-specified
@@ -263,6 +263,36 @@
    Functions should be added to ctypes to create a ctypes object from
    a struct description, and add long-double, and ucs-2 to ctypes.
 
+Examples of Data-Format Descriptions
+
+   Here are some examples of C-structures and how they would be
+   represented using the struct-style syntax:
+
+   float                     
+      'f'
+   complex double
+      'F' or 'ff'
+   RGB Pixel data
+      'BBB' or 'B:r: B:g: B:b:'
+   Mixed endian (weird but possible)
+      '>i:big: <i:little:'
+   Nested structure
+      struct {
+             int ival;
+             struct {
+                 unsigned short sval;
+                 unsigned char bval;
+                 unsigned char cval;
+             } sub;
+      }
+      'i:ival: T{H:sval: B:bval: B:cval:}:sub:'
+   Nested array
+      struct {
+             int ival;
+             double data[16*4];
+      }
+      'i:ival: (16,4)d:data:'
+
 Code to be affected
 
    All objects and modules in Python that export or consume the old



More information about the Numpy-svn mailing list