[Python-Dev] Suirprise!

Paul Prescod paulp@ActiveState.com
Sat, 21 Apr 2001 03:48:08 -0700


Tim Peters wrote:
> 
>...
> 
> >>> 'a' in 'a' == 'a'
> 1
> >>>
> 
> thank-god-for-dis.dis-ly y'rs  - tim

[potential spoilers below]

No, thank Jeremy for Compiler:

Module(None, 
    Stmt(
        [
            Printnl(
                [
                    Compare(Const('a'), 
                        [
                            ('in', Const('abcde')), 
                            ('==', Const('abcde'))
                        ]
                    )
                ], 
                None
            )
        ]
    )
)

It still took a look at the ref manual for me to figure it out.

It looks like dubious hypergeneralization to me! <0.7 wink> Seriously,
does this "feature" ever make sense to apply to the in operator?

-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook