a question regarding conciseness

Duncan Booth duncan at NOSPAMrcp.co.uk
Fri Feb 22 03:59:30 EST 2002


grante at visi.com (Grant Edwards) wrote in 
news:lI9d8.1181$N7.63227 at ruti.visi.com:

> In article <Xns91BC7AB03699duncanrcpcouk at 127.0.0.1>, Duncan Booth wrote:
>> gerson.kurz at t-online.de (Gerson Kurz) wrote in 
>> news:3c74c3d6.20466328 at news.isar.de:
>> 
>>> I found an easier solution:
>>> 
>>> sort = lambda x:(x.sort(),x)[1]
>>> 
>> If you are heading that way:
>> sort = lambda x:x.sort() or x
> 
> Assuming you never run into an "x" that returns a true value
> from its sort method...
> 
I was of course assuming that any sensible implementation of sort would 
always return None. :^)


-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list