Skip to content
Laeeth Isharc edited this page Mar 19, 2015 · 1 revision

Type Conversion

Pyd provides a series of template functions for converting types to and from Python.

See the api for particulars.

D to Python

functions py and _py

The following conversions are possible: | **D Type** | **Python Type** |bool | bool |any integral type | int |BigInt | long |float,double,real | float |std.complex.Complex | complex |string | str |dynamic array | list |static array | list |std.typecons.Tuple | tuple |associative array | dict |delegate or function pointer | callable object |a wrapped class | wrapped type |a wrapped struct | wrapped type |pointer to wrapped struct | wrapped type |PydObject | wrapped object's type |PyObject* | object's type

Python to D

function d_type.

The following conversions are possible: |**Python Type** | **D Type** |Any type | PyObject* |Any type | PydObject |Wrapped struct | Wrapped struct |Wrapped struct | Pointer to wrapped struct |Wrapped class | Wrapped class |Any callable | delegate |array.array | dynamic or static array |Any iterable | dynamic or static array |Any iterable | PydInputRange (TODO) |str | string |str | char[] |tuple | std.typecons.Tuple |complex | std.complex.Complex |float | float, double, real |int | any integral type |long | BigInt |bool | bool

Clone this wiki locally