Re: Standard library praise and challenge
- Posted by mattlewis (admin) Sep 14, 2011
- 3158 views
Anyways, back to my original point: NaN and Nothing are conceptually separate values.
Yes, I totally agree. I just noticed that NaN was missing from our collection of constants.
While it may make sense for NaN to be the output of std/math.e's min() and max() and sum() and perhaps even or_all() when they are given an empty sequence as input, NaN does not work the same way as our NOVALUE (or even Python's Nothing object).
I wouldn't use NaN for that (ideally). I'd prefer to use NOVALUE. I suppose one issue we have with that is the way we currently check for initialized values, which is to say, as little as possible. Allowing NOVALUE to be used explicitly would cause all sorts of new bugs.
OTOH, if you're passing an empty sequence to max/min, then you probably have a bug in your code already.
Matt