On Nov 11, 8:02 am, "M.-A. Lemburg" <[EMAIL PROTECTED]> wrote: > On 2008-11-11 02:10, Steven D'Aprano wrote: > > > On Mon, 10 Nov 2008 12:51:51 +0000, Duncan Grisby wrote: > > >> I have an object database written in Python. It, like Python, is > >> dynamically typed. It heavily relies on being able to sort lists where > >> some of the members are None. To some extent, it also sorts lists of > >> other mixed types. It will be very hard to migrate this aspect of it to > >> Python 3. > > > No, it is "very hard" to sort *arbitrary* objects consistently. If it > > appears to work in Python 2.x that's because you've been lucky to never > > need to sort objects that cause it to break. > > If you read Duncan's email, he isn't talking about arbitrary objects > at all. He's just referring to being able to sort lists that contain > None elements. > > That's far from arbitrary and does work consistently in Python 2.x - > simply because None is a singleton which is special cased in Python: > None compares smaller to any other object in Python. > > I'm not sure why this special case was dropped in Python 3.0. None > is generally used to be a place holder for a n/a-value and as > such will pop up in lists on a regular basis. > > I think the special case for None should be readded to Python 3.0.
On python-ideas I proposed adding two new builtin singletons instead, Smallest and Largest, since the behavior of None wrt comparisons was never officially part of the language. George -- http://mail.python.org/mailman/listinfo/python-list