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

Anders Hovmöller boxed at killingar.net
Sun Sep 30 10:45:19 EDT 2018

>> I am roughing out such a class and some test cases which will hopefully 
>> include some cases where the hoped for advantages can be realised.
>> My thinking on bitwise operations is to do the same as arithmetic 
>> operations, i.e. (anything op iNaN) = iNaN and likewise for shift 
>> operations.
> Steve,
> While you are extending a number system, can every int be truthy, while
> only iNan be falsey?  I found that behaviour more useful because
> checking if there is a value is more common than checking if it is a
> zero value.

I’m not saying you’re wrong in principle but such a change to Python seems extremely disruptive. And if we’re talking about robustness of code then truthiness would be better like in Java (!) imo, where only true is true and false is false and everything else is an error. If we’re actually talking about changing the truth table of Python for basic types then this is the logical next step.

But making any change to the basic types truth table is a big -1 from me. This seems like a Python 2-3 transition to me. 

/ Anders

More information about the Python-ideas mailing list