finish_endtag in sgmllib.py [Python 2.4]

Richard Hsu richard.hsu at gmail.com
Tue Apr 11 20:37:10 EDT 2006


code:-

   # Internal -- finish processing of end tag
    def finish_endtag(self, tag):
        if not tag:  # <---- i am confused about this
            found = len(self.stack) - 1
            if found < 0:
                self.unknown_endtag(tag)  # <---- and this
                return

I am a little confused as to what is intended by " if not tag: "
does it mean
if tag == None or tag == "":  # ?

tag here is suppose to be a string.

so the only way it will be True is when its either None or its "", then
we are essentially passing None or "" to self.unknown_endtag(tag) ??

thank you in advance.

Richard Hsu
hobbyist programmer.
Toronto, Canada.




More information about the Python-list mailing list