Closed acu192 closed 5 years ago
From the documentation (here), it shows how to specify the type of a fixed array. Here is that example below:
>>> from xnd import xnd >>> >>> xnd([[0, 1, 2], [3, 4, 5]]) xnd([[0, 1, 2], [3, 4, 5]], type='2 * 3 * int64') >>> >>> xnd([[0, 1, 2], [3, 4, 5]], type='2 * 3 * uint8') xnd([[0, 1, 2], [3, 4, 5]], type='2 * 3 * uint8')
However, specifying the type is not possible if you are building a ragged array:
>>> from xnd import xnd >>> >>> xnd([[0, 1, 2], [3, 4]]) xnd([[0, 1, 2], [3, 4]], type='var * var * int64') >>> >>> xnd([[0, 1, 2], [3, 4]], type='var * var * uint8') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/ryan/github/xnd-all/python/xnd/__init__.py", line 127, in __new__ return super().__new__(cls, type=type, value=value) ValueError: type must be concrete
Actually it's possible, see here:
https://xnd.readthedocs.io/en/latest/xnd/types.html#id2
Aww cool. Thank you!
From the documentation (here), it shows how to specify the type of a fixed array. Here is that example below:
However, specifying the type is not possible if you are building a ragged array: