Leticia Larrosa wrote:
Hi all:
I want to order a sequence using the Sequence sorting module from a Python script. I have the following code: " seq = [['Bruzon', 'CUB'], ['Anand', 'IND'], ['Kasparov', 'RUS']] def test(oneElem, twoElem): if oneElem[0] == twoElem[0]: return 0 elif oneElem[0] > twoElem[0]: return 1 else: return -1 sort_on =(('self', test, 'desc')) return sequence.sort(seq, sort_on) " and i get the error: " Error Type: SyntaxError Error
Value: sort option must contains no more than 2 fields Leticia, I tested this using a python script in Zope - and it seems to work. Nice to see someone doing something with Chess and Zope! def test(x,y): if x[0] == y[0]: return 0 elif x[0] > y[0]: return 1 else: return -1 request = container.REQUEST seq = [['Bruzon', 'CUB'], ['Anand', 'IND'], ['Kasparov', 'RUS']] seq.sort(test) print seq David