3 ms·
This is interesting because possibly no one has ever used it in code logic, for anything, ever. (Except to work around the faulty falsy definition.) The way t
by logicallee 13y ago
This is interesting because possibly no one has ever used it in code logic, for anything, ever. (Except to work around the faulty falsy definition.)
The way this would be apparent is to simply look through a statistical sampling of uses. If 80% of the time the code is used in a boolean context, the code is actually broken, meanwhile the falsiness is used, correctly, in 0.0% of the code, then you can silently fix 80% of errors without breaking anything. Moreover, if falsiness is not explicitly relied on, but just caught kind of as an exception, then removing the false sentinel value may only cause errors by creating "exception-handling" that never runs. If this is the only "cost", while you can subtlely fix 80% of code that uses the false value (wrongly), then do it.
It would be interesting to know if anyone was using the sentinel value (correctly) and relying on it.
- pekk 13y agoTons of people use 'is None' correctly as a sentinel value
- logicallee 13y agoThat wasn't what I was discussing.
- maxerickson 13y agoIt's stated in the article that a couple of people had used the false value in code that was not distributed.