[Python-ideas] math.inf and math.nan constants

Steven D'Aprano steve at pearwood.info
Wed Jan 7 19:46:56 CET 2015

On Wed, Jan 07, 2015 at 07:31:00PM +0100, Antoine Pitrou wrote:

> However we could have a random.nan() function to get random NaNs
> (perhaps with different distributions).

Do you have a use case for random NANs?

I'd rather have the float constructor allow you to specify the payload, 
as decimal already does:

py> decimal.Decimal('nan123')

or possible a class method:



More information about the Python-ideas mailing list