On Sat, 29 Sep 2018 at 19:38, Steve Barnes <gadgetst...@live.co.uk> wrote:
>
> On 29/09/2018 09:56, Serhiy Storchaka wrote:
> > 29.09.18 11:43, Steve Barnes пише:
> >> On 29/09/2018 08:50, Serhiy Storchaka wrote:
> >>> Python is dynamically typed language. What is such processing that would
> >>> work with iNaN, but doesn't work with float('nan')?
> >>>
> >> One simplistic example would be print(int(float('nan'))) (gives a
> >> ValueError) while print(int(iNaN)) should give 'nan' or maybe 'inan'.
> >
> > Why do you convert to int when you need a string representation? Just
> > print(float('nan')).
> > 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.

Your requirement to have a whole number cannot meaningfully be
satisfied if your input is nan so an exception is the most useful
result.

--
Oscar
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to