elementtree behavior

Tim Arnold tiarno at sas.com
Mon Sep 27 19:39:34 CEST 2004


I have an XML snippet that I parse with ElementTree, and I get an element
called self.makeToc

Now this code:

        print self.makeToc
        if self.makeToc != None:
            print 'here'
            if self.makeToc: print 'but not here'

gives this result:
<Element toc at 40197e88>
here

Clearly self.makeToc has a value, so why isn't "if self.makeToc"  True?
That is, if self.makeToc isn't None, why don't I get past 'if self.makeToc'

Can someone point out what am I not understanding?

thanks,
--Tim






More information about the Python-list mailing list