Use cases for del

Terry Reedy tjreedy at udel.edu
Sun Jul 10 16:14:44 EDT 2005


"Ron Adam" <rrr at ronadam.com> wrote in message 
news:OI_ze.189063$IO.87173 at 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 






More information about the Python-list mailing list