[Python-ideas] [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)
Mark Dickinson
dickinsm at gmail.com
Thu Aug 6 17:41:52 CEST 2009
On Thu, Aug 6, 2009 at 4:14 PM, Steven D'Aprano<steve at pearwood.info> wrote:
> By memory, the IEEE standard allows for 254 different NANs.
Did you mean 2**54 here? For IEEE 754 binary64 format, I count
2**53-2 bit patterns representing NaNs: 2**52 quiet NaNs and
2**52-2 signaling NaNs. (The 11 exponent bits must all be 1s;
the sign bit and the 52 significand bits can be chosen arbitrarily,
except that two bit patterns are reserved for +/-infinity; the top
significand bit determines whether you've got a signaling or
quiet NaN).
</nitpick>
I agree that that particular example isn't particularly compelling,
but I've definitely encountered other cases where I would have
used this construct if it were available. Not that that necessarily
makes it a good idea. :-)
Mark
More information about the Python-ideas
mailing list