bigint <-> python long

bearophile bearophileHUGS at lycos.com
Thu Sep 6 04:11:35 PDT 2012


Ellery Newcomer:

>> array.array <==> D arrays
>
> just checked, looks like we have it:
>
> PyStmts(q"{from array import array; a = array('i', 
> [44,33,22,11]);}", "testing");
> assert(PyEval!(int[])("a", "testing") == [44,33,22,11]);
>
> I think if the python object is iterable, it can be converted 
> to array.

array.array are special, they aren't Python lists. array.array 
contains uniform data, so conversion to D arrays is a memcpy (or 
it's nearly nothing if you don't copy the data).

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list