On 12/29/19 10:58 AM, David Mertz wrote:
On Sun, Dec 29, 2019, 10:51 AM Steve Barnes <gadgetst...@live.co.uk <mailto:gadgetst...@live.co.uk>> wrote:

    I  do have to disagree here as it is entirely possible, in the
    world of hardware interfacing, that an external hardware device
    could possibly supply an sNaN  as a something was seriously wrong
    flag, (as opposed to a I haven't got any data at the moment).


Wouldn't the right time to handle an sNaN coming from hardware *always* be upon acquisition rather than sticking it in a collection to operate on later? Fail-fast fail-hard seems like basic good design, that much more so when it comes to hardware.
One classic use of sNaNs is to initiallize your data array to sNaN, and if any operation attempts to use the data before it is set to a 'real' value, you trap at that point, which is where the error is. Perhaps Python, with its more advanced data structures has less need for this type of thing, but I suspect that even in Python there are cases where prefilling with non-existent value could make sense as an optimization, with an advantage to having all the elements be the same type (so you wouldn't use None at the value).

--
Richard Damon
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/VZHYQ3BYUZJMFSETOVGTMVD7XQLEMUCR/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to