Hello,<div><br></div><div>I would like to be able print NumPy arrays matching the IDL's array print outout. For instance:</div><div><br></div><div><div>IDL> print, findgen(5)</div><div> 0.00000 1.00000 2.00000 3.00000 4.00000</div>
<div>IDL> print, dindgen(5)</div><div> 0.0000000 1.0000000 2.0000000 3.0000000 4.0000000</div></div><div> 0.0000000 1.0000000 2.0000000 3.0000000 4.0000000</div>
<div><br></div><div><br></div><div><div>I1 np.arange(5, dtype='float64')</div><div>O1 0.0000000 1.0000000 2.0000000 3.0000000 4.0000000</div></div><div><br></div><div>I2 np.arange(5, dtype='float32')</div>
<div><div>O2 0.00000 1.00000 2.00000 3.00000 4.00000</div></div><div><br></div><div>Ignoring O1 and O2 lines, outputs (formatting) are matching. I achieved this by defining some custom pprint formatters in the IPy config file.</div>
<div><br></div><div>However, this is only valid within IPython while just typing array names. For instance, running these lines revert the printing settings back to normal.</div><div><br></div><div>Is there a way to make this type of customized printing default for executing a file via Python? ie., can we replace python's print statement with pprint?</div>
<div><br></div><div>If not, should I edit numpy/core/arrayprint.py and use a pythonrc file to achieve the effect?</div><div><br></div><div>I am also interested in custom printing other data types than nd.arrays.</div><div>
<br></div><div>Thanks.</div><div><br></div><div>-- </div><div>Gökhan<br>
</div>