1. ariovistus
  2. pyd

Wiki

Clone wiki

pyd / TypeConversion

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 TypePython Type
boolbool
any integral typeint
BigIntlong
float,double,realfloat
std.complex.Complexcomplex
stringstr
dynamic arraylist
static arraylist
std.typecons.Tupletuple
associative arraydict
delegate or function pointercallable object
a wrapped classwrapped type
a wrapped structwrapped type
pointer to wrapped structwrapped type
PydObjectwrapped object's type
PyObject*object's type

Python to D

function d_type.

The following conversions are possible:

Python TypeD Type
Any typePyObject*
Any typePydObject
Wrapped structWrapped struct
Wrapped structPointer to wrapped struct
Wrapped classWrapped class
Any callabledelegate
array.arraydynamic or static array
Any iterabledynamic or static array
Any iterablePydInputRange (TODO)
strstring
strchar[]
tuplestd.typecons.Tuple
complexstd.complex.Complex
floatfloat, double, real
intany integral type
longBigInt
boolbool

Updated