Changes between Version 2 and Version 3 of Python API

Show
Ignore:
Timestamp:
09/20/13 14:54:40 (11 years ago)
Author:
jorisborgdorff
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Python API

    v2 v3  
    3737}}} 
    3838These functions behave just like their [wiki:"C++ API" C++ counterparts], except `init`, `send` and `receive`. For `init`, first run `import sys` and then `muscle.init(sys.argv)`. Send will accept a sequence of objects, given a muscle datatype. The following datatypes are recognized: 
    39 |= Object |= Python data type |= C data type | 
    40 | muscle.int | sequence of `int` | 32-bit `int` | 
    41 | muscle.long | sequence of `int` | 64-bit `long` | 
    42 | muscle.float | sequence of `double` | 32-bit `float` | 
    43 | muscle.double | sequence of `double` | 64-bit `double` | 
    44 | muscle.boolean | sequence of `bool` | `bool` | 
    45 | muscle.raw | `bytearray` | `char *` | 
    46 | muscle.string | `str` | `const char *` | 
    47  
     39||= Object ||= Python data type ||= C data type || 
     40|| muscle.int || sequence of `int` || 32-bit `int` || 
     41|| muscle.long || sequence of `int` || 64-bit `long` || 
     42|| muscle.float || sequence of `double` || 32-bit `float` || 
     43|| muscle.double || sequence of `double` || 64-bit `double` || 
     44|| muscle.boolean || sequence of `bool` || `bool` || 
     45|| muscle.raw || `bytearray` || `char *` || 
     46|| muscle.string || `str` || `const char *` || 
    4847The first five data types take any sequence, as long as the Python datatype that is contained matches. In some cases, it may be necessary to recreate a NumPy array so that the canonical Python datatypes are used. For example, with `int`: 
    4948{{{