[Python-Dev] Got None. Maybe Some? (original) (raw)

Tim Peters tim.one at comcast.net
Mon Dec 22 11:46:01 EST 2003


[Guido]

... And I repeat my question: which other language has that concept?

Variations on None were debated pretty exhaustively during Python's first year (yes, that was a while ago ).

Some obscure functional languages have "top" and "bottom" values. There's a partial ordering among values, and "top" and "bottom" are added to make a lattice out of that. "bottom" is usually identified as "the error value", and f(..., bottom, ...) is defined to return bottom for all functions f then.

That's not really like None, it's more like 754's NaN (although NaN0.0 in C99 is defined to return 1, not NaN, under the theory that it doesn't matter if an error occurred during the computation of the base, because base0 is 1 no matter what base should have been).

Aaron Watters also identified several distinct detailed semantics for "missing value" markers in assorted database languages, which are closer to what Python's None usually intends ("I'm not really here, but something has to be here so I'm it").

If all that's really wanted is an object that compares larger than anything else, it's easy to define such a beast (and I see Michael Chermside posted code for that already). If more than that is wanted, then it becomes more a collection of arbitrary behaviors, and then different apps will want different arbitrary behaviors. None is handy and I like it, but it's arbitrary enough in some cases that it takes time to get used to its quirks (e.g., why is a value that's "not really there" considered to be false? why not? sometimes that's what you want; sometimes you'd rather get an exception; None picks an arbitrary answer and sticks to it), so I don't want see more things like it proliferate (one is enough -- but not too many ).



More information about the Python-Dev mailing list