R
richard.hsu
I am new to python language and most of my python programming has been
done with IronPython.
I was looking at the source of markupbase.py which is included with
Python 2.4 and came across the following line of code:-
if rawdata[j:j+1] == '--': #comment
i was confused because based on my understanding of the slicing syntax,
rawdata[j:j+1] will either yield a string with ONE character or an
empty string, therefore this boolean comparison will always be False
because we are checking if it will be equal to a string with 2
characters!
am I missing something here ?
thank you in advance for educating me.
done with IronPython.
I was looking at the source of markupbase.py which is included with
Python 2.4 and came across the following line of code:-
if rawdata[j:j+1] == '--': #comment
i was confused because based on my understanding of the slicing syntax,
rawdata[j:j+1] will either yield a string with ONE character or an
empty string, therefore this boolean comparison will always be False
because we are checking if it will be equal to a string with 2
characters!
am I missing something here ?
thank you in advance for educating me.