Roy Smith wrote:
> In article <[EMAIL PROTECTED]>,
>  Joel Hedlund <[EMAIL PROTECTED]> wrote:
> 
>> Which means that "is" comparisons in general will be faster than == 
>> comparisons.
> 
> I thought that == automatically compared identify before trying to compare 
> the values.  Or am I thinking of some special case, like strings?

Even for strings there is a performance difference:

>>> timeit.Timer("'a'=='a'").timeit()
0.26859784126281738
>>> timeit.Timer("'a' is 'a'").timeit()
0.21730494499206543

mfg
- eth
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to