why not "'in' in 'in'"?

Duncan Booth duncan at NOSPAMrcp.co.uk
Thu Jun 13 10:40:05 CEST 2002

Grant Griffin <not.this at seebelow.org> wrote in 
news:3D082A62.CF800C75 at seebelow.org:

>> Grant Griffin wrote:
>>  This peculiar lack of generality seems a bit (dare I say
>>  it?) "non-Pythonic".
<lots of snips and then>
> But anyway, let's "just say no" to the tuple case rather than confuse
> ourselves; let's just make the string version of "in" a special case. 

I see a slight lack of consistency in your approach here. First you 
complain that the way 'in' works lacks generality, then when everyone 
points out that to make it work the way you would expect would make it 
break on lists or tuples you suggest special casing.

The Pythonic way is to maintain generality, not to introduce special cases.

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