[Python-Dev] Re: Got None. Maybe Some?

Tim Peters tim.one at comcast.net
Mon Dec 22 15:34:38 EST 2003


[Paul Moore]
> ...
> The fact that [None] compares less than every other value is to me
> incidental, and arbitrary.

Arbitrary?!  I clearly recall when the decision was made that None would
compare less than anything else.  I was in the same room with Guido, and
this is a verbatim transcript of the debate:

"As long as we're changing everything here anyway, maybe comparing with None
should yield a consistent result."

"Like what, maybe smaller than anything else?"

"Sure.  Or larger."

"Ya, one of those.  It's not worth it if it just ends up in the middle
somewhere."

"What does Python do now?"

... [head-scratching] ...

"So what did it do before?"

... [more head-scratching] ...

"Well, that's no help, then."

"The Reference Manual doesn't promise anything about how None will compare,
just the 'consistent total ordering' bit".

"So that doesn't constrain us."

"No, it's neutral."

"So maybe it should just be smaller than everything else."

"Sure.  Or larger."

"If it were smaller, then when you sorted a mixed-type list, all the Nones
would float to the start."

"Good point.  If it were larger, they'd float to the end."

"I wouldn't like that much."

"Me neither."

"OK, it's settled."

Two lines of code later, the Only Objectively Correct result was achieved.

history-is-more-impressive-in-textbooks-ly y'rs  - tim




More information about the Python-Dev mailing list