[Python-ideas] Suggestion: Extend integers to include iNaN

Steven D'Aprano steve at pearwood.info
Sun Sep 30 08:55:42 EDT 2018


On Sun, Sep 30, 2018 at 12:09:45PM +0300, Serhiy Storchaka wrote:
> 30.09.18 04:07, Steven D'Aprano пише:
> >Telling people that they don't understand their own code when you don't
> >know their code is not very productive.
> 
> I can't tell him what he should do with his (not working) code, but it 
> doesn't look like a good justification for changes in the Python core.

You don't know that his code is not working. For all you know, Steve has 
working code that works around the lack of an int NAN in some other, 
more clumsy, less elegant, ugly and slow way.

NANs are useful for when you don't want a calculation to halt on certain 
errors, or on missing data. That ability of a NAN to propogate through 
the calculation instead of halting can be useful when your data are 
ints, not just floats or Decimals.

Earlier, I suggested that this proposal would probably be best done as a 
subclass of int. It certainly should be prototyped as a subclass before 
we consider making a builtin int NAN. Since Steve has already agreed to 
work on that first, I think any further discussion would be pointless 
until he comes back to us. He may decide that a subclass solves his 
problem and no longer want a builtin int NAN.


-- 
Steve
but not the same Steve as above...


More information about the Python-ideas mailing list