Any example of Server/Client Side Sorting?

Zhang Huangbin zhbmaillistonly at gmail.com
Fri May 15 14:46:14 CEST 2009


Michael Ströder wrote:
>
> Sorry, there's a typo in there:
>
> cmp=lambda x,y: cmp(x[0].lower(), y[0}.lower())
>                                      ^
> Should be ]


I found that before, but got the same error:

 >>> alist
[('mail=postmaster at a.cn,o=domainAdmins,dc=iredmail,dc=org', {'mail': 
['postmaster at a.cn'], 'accountStatus': ['active'], 'enabledService': 
['awstats'], 'domainGlobalAdmin': ['yes']}), 
('mail=www at a.cn,o=domainAdmins,dc=iredmail,dc=org', {'mail': 
['www at a.cn'], 'accountStatus': ['active'], 'domainGlobalAdmin': 
['yes']}), ('mail=www5 at a.cn,o=domainAdmins,dc=iredmail,dc=org', {'mail': 
['www5 at a.cn'], 'accountStatus': ['active'], 'domainGlobalAdmin': 
['no']}), ('mail=www3 at a.cn,o=domainAdmins,dc=iredmail,dc=org', {'mail': 
['www3 at a.cn'], 'accountStatus': ['active'], 'domainGlobalAdmin': ['no']})]

 >>> cmp=lambda x,y: cmp(x[0].lower(), y[0].lower())

 >>> alist.sort(cmp)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 1, in <lambda>
  File "<stdin>", line 1, in <lambda>
  File "<stdin>", line 1, in <lambda>
  File "<stdin>", line 1, in <lambda>
  File "<stdin>", line 1, in <lambda>
  File "<stdin>", line 1, in <lambda>
  File "<stdin>", line 1, in <lambda>
  File "<stdin>", line 1, in <lambda>
  ...... SKIP MANY LINES HERE ......
  File "<stdin>", line 1, in <lambda>
  File "<stdin>", line 1, in <lambda>
  File "<stdin>", line 1, in <lambda>
  File "<stdin>", line 1, in <lambda>
RuntimeError: maximum recursion depth exceeded

-- 
Best regards.

Zhang Huangbin

- Open Source Mail Server Solution for RHEL, CentOS, Debian:
  http://code.google.com/p/iredmail/





More information about the python-ldap mailing list