[Edward Pollard]
On Thursday, September 12, 2002, at 11:39 AM, Passin,Thomas B. (Tom) wrote:
[ Edward Pollard]
Is this the incorrect way to compare strings? Is there a
better way
to do this?
if a==b: #do something
I tried this. It did not work. My thoughts are that == would compare the pointers to the objects, not the contents.
It works for ordinary Python sequences and strings:
a='this is a test' b=''this is a test' a==b 1 b='xxx' a==b 0
For other object, it depends on how the comparison has been coded in the class or type.
Code wise, I have this <span tal:condition="python:items.title_or_id == template.title_or_id" tal:replace="Content I want">Filler</span>
items being the list I'm iterating through.
So the obvious (==) didn't work (apologies for not clarifying this in the first place), the next-obvious (cmp) didn't work, what will?
You may have to use the string value for the comparison. Cheers, Tom P