v923z / micropython-ulab

a numpy-like fast vector module for micropython, circuitpython, and their derivatives
https://micropython-ulab.readthedocs.io/en/latest
MIT License
432 stars 117 forks source link

Add a ULAB_PRINT_DTYPE constant #602

Open HugoNumworks opened 1 year ago

HugoNumworks commented 1 year ago

I don't know if it is something you would like to add, but I added a small option for the display of "dtype=..." when printing an array.

v923z commented 1 year ago

I'm not against it, but there seems to be some discrepancy in numpy itself. What is the rule for printing dtype?

HugoNumworks commented 1 year ago

there seems to be some discrepancy in numpy itself

I don't use Numpy very often, but I think I have never seen the dtype printed alongside the array, in which case does it happen ?

v923z commented 1 year ago

there seems to be some discrepancy in numpy itself

I don't use Numpy very often, but I think I have never seen the dtype printed alongside the array, in which case does it happen ?

This doesn't print the dtype:

>>> linspace(0, 10, num=11)
array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10.])
HugoNumworks commented 1 year ago

there seems to be some discrepancy in numpy itself

I don't use Numpy very often, but I think I have never seen the dtype printed alongside the array, in which case does it happen ?

This doesn't print the dtype:

>>> linspace(0, 10, num=11)
array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10.])

Sorry, I meant to ask : In which case does Numpy display the dtype ?

I'm adding the option in here so that it is now possible to disable the display of "dtype=". Currently, it is always displayed, so I set ULAB_PRINT_DTYPE to 1 by default, but my goal is to be able to deactivate it.

v923z commented 1 year ago

Sorry, I meant to ask : In which case does Numpy display the dtype ?

I don't know, and that's why I would like to hold off with this, till it is sorted out.