Copy a string: Difference between revisions

Warning about comparing strings
(→‎[[C]]: organized a bit more)
(Warning about comparing strings)
Line 208:
 
As a result of object "interning" some strings such as the empty string and single character strings like 'a' may be references to the same object regardless of copying. This can potentially happen with any Python immutable object and should be of no consequence to any proper code.
 
Be careful with 'is' - use it only when you want to compare the identity of the object. To compare string values, use '=='.
 
==[[Ruby]]==
Anonymous user