Steve Holden wrote:
.........intain).

Of course, using SQL against a traditional RDBMS will not return rows
with NULL values for salary in a query such as

  SELECT name, address WHERE salary < 10000

precisely *because* NULL (absence of value) does not compare with any
value. So you could say that 3.0 is forcing us to acknowledge database
reality ;-)

regards
 Steve
on the other hand I find it odd that

cmp(None,None) fails in Python 3 when None==None returns True.

In fact it seems that because None is non-comparable I need to write at least three of the comparisons at least as two only leads to errors. So now even though I can sort my objects with None I still cannot sort [None,None]

class A:
        def __init__(self,val):
                self.val=val
        def __lt__(self,other):
                if other is None: return False
                return self.val<other.val
        def __eq__(self,other):
                if other is None:
                        return False
                return self.val==other.val
        def __gt__(self,other):
                if other is None: return True
                return self.val>other.val
        def __repr__(self):
                return 'A(%s)' % self.val

a=A(1)
b=A(2)
print('cmp(a,b) --> %s'%(cmp(a,b)))
print('a<b --> %s'%(a<b))
print('a>b --> %s'%(a>b))
print('a==b --> %s'%(a==b))
print('a<None --> %s'%(a<None))
print('a>None --> %s'%(a>None))
print('a==None --> %s'%(a==None))
print('None<a --> %s'%(None<a))
print('None>a --> %s'%(None>a))
print('cmp(a,None) --> %s'%(cmp(a,None)))

L=[b,a]
L.sort()
print('L --> %s'%(L))
L=[b,a,None]
L.sort()
print('L --> %s'%(L))
--
Robin Becker

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to