algorithm does python use to compare two strings

Terry Reedy tjreedy at udel.edu
Sun Apr 29 06:05:58 EDT 2012


On 4/29/2012 3:59 AM, J. Mwebaze wrote:
> I am just wondering which specific algorithm does python use to compare
> two strings.

'Python' does not use algorithms, implementations do. CPython may check 
id and or hash before doing a character-by-char comparison (or perhaps 
multiple chars at a time).

-- 
Terry Jan Reedy




More information about the Python-list mailing list