feature request: a better str.endswith

Duncan Booth duncan at NOSPAMrcp.co.uk
Wed Jul 23 04:06:17 EDT 2003


bokr at oz.net (Bengt Richter) wrote in news:bfjokm$kbc$0 at 216.39.172.122:

>>'all_false(...)' is simply 'not any_true(...)'
>>'any_false(...)' is 'not all_true(...)'
>>
>>So you could get by with just two of these functions, in which case 
>>'any_of', and 'all_of' might be suitable names.
>>
> I don't think they're equivalent if they do short-circuiting.
> 

any_true short circuits as soon as it finds one that is true.
all_false short circuits as soon as it find one that is true.

all_true short circuits as soon as it finds on that is false.
any_false ditto.

Why aren't they equivalent?

-- 
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