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 Right now to get the desired semantics, I implement a custom AlwaysLeast and/or AlwaysGreatest singletons for whatever type I'm dealing with. It's a bit of of a pain. My use cases are all along the following lines: class TimeSpan: def __init__(self): self.earliest = AlwaysGreatest self.latest = AlwaysLeast def update(self, v): self.earliest = min(self.earliest, v) self.latest = max(self.latest, v) -- Daniel Stutzbach, Ph.D. http://www.barsoom.org/~agthorr <http://www.barsoom.org/%7Eagthorr>
_______________________________________________ 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