Python Nelson types

Managing Data between Python and Nelson.

Description

Managing data returned by Python functions:

Convert Python types to Nelson type explicitly:

Pass scalar Nelson type to Python:

Pass 1-by-N Vector Nelson type to Python:

Pass 2D Matrices and ND Arrays to Python:

The Python language offers a protocol for accessing memory buffers, akin to the data stored in Nelson arrays.

Nelson incorporates this Python buffer protocol for its arrays.

Examples

R = pyrun('', "A", 'A', magic(3))
R.double()

dictionary conversion nelson -- python

wheels = [1 2 3];
names = ["Monocycle" "Bicycle" "Tricycle"];
d = dictionary(wheels, names)
R = pyrun("A = d", "A", 'd', d)
dictionary(R)

See also

pyrun, dictionary.

History

Author

Allan CORNET

Last updated