[Python-ideas] Suggestion: Extend integers to include iNaN
steve at pearwood.info
Sat Sep 29 21:07:26 EDT 2018
On Sat, Sep 29, 2018 at 10:05:39PM +0300, Serhiy Storchaka wrote:
> 29.09.18 21:38, Steve Barnes пише:
> >>Why do you convert to int when you need a string representation? Just
> >>I converted to int because I needed a whole number, this was intended to
> >represent some more complex process where a value is converted to a
> >whole number down in the depths of the processing.
> float('nan') is a number (in Python sense). No need to convert it.
Steve just told you that he doesn't need a number, he needs a whole
number (an integer), and that this represents a more complex process
that includes a call to int.
Why do you dismiss that and say there is no need to call int when you
don't know the process involved?
It *may* be that Steve could use math.floor() or math.ceil() instead,
neither of which have the same meaning as calling int(). But more likely
he DOES need to convert it by calling int, just as he says.
Telling people that they don't understand their own code when you don't
know their code is not very productive.
More information about the Python-ideas