is and == (is not other_thread)

Grant Griffin not.this at seebelow.org
Thu Mar 1 23:01:16 EST 2001


Fredrik Lundh wrote:
> 
> Grant Griffin wrote:
> > 1) Are two strings that are equal in the "==" sense always
> > guaranteed to be equal in the "is" sense?
> 
> no.
> 
> > 2) Is "is" faster than "==" for strings?
> 
> marginally.  "==" executes a bit more C code before it
> gets to the identity test.
> 
> > 3) Internally, does "==" for strings always begin with an "is"
> > operation?
> 
> yes
> 
> for the details, see cmp_outcome in Python/ceval.c, and
> PyObject_Compare in Objects/Object.c.
> 
> Cheers /F

Thanks /F (and others) for some great answers!

you-bots-know-even-more-obscure-facts-than-kurt-russell-did-in-
   'the-computer-wore-tennis-shoes'-<wink>-ly y'rs,

=g2
-- 
_____________________________________________________________________

Grant R. Griffin                                       g2 at dspguru.com
Publisher of dspGuru                           http://www.dspguru.com
Iowegian International Corporation            http://www.iowegian.com



More information about the Python-list mailing list