[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: Use cases for del
From:       "Terry Reedy" <tjreedy () udel ! edu>
Date:       2005-07-10 20:14:44
Message-ID: darvjk$4bk$1 () sea ! gmane ! org
[Download RAW message or body]


"Ron Adam" <rrr@ronadam.com> wrote in message 
news:OI_ze.189063$IO.87173@tornado.tampabay.rr.com...
> To avoid that you either need to define the flag string as a global name
> or use it strictly in the local scope it's defined in.  Python will also
> sometimes reuse strings as an optimization instead of creating a second
> string if they are equal.  Something else to be aware of.

I believe CPython's string equality function first checks the two strings 
for identity.  So one gets most of the benefit of 'is' testing anyway.  (An 
I presume it next check for length equality.)

tjr 



-- 
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic