String Identity Test
Avetis KAZARIAN
avetis.k at gmail.com
Wed Mar 4 04:07:44 EST 2009
Gary Herron wrote:
> The question now is: Why do you care? The properties of strings do
> not depend on the implementation's choice, so you shouldn't care because
> of programming considerations. Perhaps it's just a matter of curiosity
> on your part.
>
> Gary Herron
Well, it's not about curiosity, it's more about performance.
I will make a PHP example (a really quite simple )
PHP :
Stat 1 : $aVeryLongString == $anOtherVeryLongString
Stat 2 : $aVeryLongString === $anOtherVeryLongString
Stat 2 is really faster than Stat 1 (due to the binary comparison)
As I said, I'm coming from PHP, so I was wondering if there was such a
difference in Python.
Because I was trying to use "is" as for "===".
More information about the Python-list
mailing list