On 2008-11-11 19:20, Tim Peters wrote: > [M.-A. Lemburg] >> ... >> That's fine. I'm just talking about the special case for None that >> has existed in Python for years - and for a good reason. > > That's overstating it a bit ;-) In Python 1.5.1, comparisons were > changed so that objects of numeric types compared smaller than objects > of non-numeric types, and then 0 < None was true, not None < 0 (which > became true substantially later). The reason for that change is > explained in Misc/HISTORY (it was an attempt to preserve transitivity > across chains of mixed-type comparisons). > > Later, during the move to rich comparisons, I was hacking the code in > the same room with Guido, and realized something special had to be > done with None. > > "Hey, Guido, what should we do about mixed-type comparisons against None?" > > "Hmm ... what do you think?" > > "Hmm ... OK, let's make None smaller than other types." > > "Why?" > > "Oh, why not?" > > "Good enough -- but let's not document it -- it's an arbitrary > implementation detail." > > "Of course!" > > In any case, we thought this was so arbitrary that we didn't hesitate > to break that, up until that time, "0 < None" /had/ been true "for > years - and for a good reason" ;-) > > not-all-good-reasons-are-particularly-good-ly y'rs - tim
Thanks for that bit of history :-) With "good reason" I meant special casing None w/r to putting it in a fixed place somewhere into the ordering scheme. The important aspect is getting it in there, not the exact position it takes. None could also compare larger than any other object, or smaller than all objects with type names starting with a 'P' and larger than all objects with type names starting with an 'O'. You just need to get it in there somewhere in order to have comparisons with None not fail with an exception. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com