Element bug?(ElementTree)

Fredrik Lundh fredrik at pythonware.com
Sun Dec 23 04:30:01 EST 2007


limodou wrote:

> I don't know if it's a bug? Try below code:
> 
>  >>> from elementtree.ElementTree import Element
>  >>> a = Element('a')
>  >>> if a:
>  ...     print 'hhhh'
>  ...
>  >>> a.__len__()
>  0
> 
> You can see if I test a, the result will be False. I don't know if
> it's an expected result, but this thing has beaten me some times.

http://effbot.org/zone/element.htm#truth-testing

</F>




More information about the Python-list mailing list