On 2008-11-11 15:22, Daniel Stutzbach wrote: > On Tue, Nov 11, 2008 at 7:06 AM, M.-A. Lemburg <[EMAIL PROTECTED]> wrote: > >> Why was the special case for None being "smaller" than all other >> objects in Python removed from Python 3.0 ? (see object.c in Py2.x) >> > > It wasn't true in Python 2.5, either. Observe: > > Cashew:~/pokersleuth/tracker$ python2.5 > Python 2.5 (r25:51908, Feb 26 2007, 08:19:26) > [GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin > Type "help", "copyright", "credits" or "license" for more information. >>>> import datetime >>>> now = datetime.datetime.now() >>>> now < None > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > TypeError: can't compare datetime.datetime to NoneType
You're right, it's a bit unfortunate, that the special casing is only applied as fall back mechanism in Python 2.x and that's not always triggered when dealing with objects implementing rich comparisons. However, it does work for all the basic built-in types in Python, such as strings, numbers, lists, tuples, dicts, etc. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 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