[issue3195] invalid conversion xml.etree.ElementTree.Element object to boolean

Pavel Strashkin report at bugs.python.org
Wed Jun 25 11:09:16 CEST 2008


New submission from Pavel Strashkin <xaka2004 at gmail.com>:

Python 2.5.2 (r252:60911, May  7 2008, 15:19:09)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from xml.etree.ElementTree import Element
>>> e = Element('Test', {'attr' : 'value'})
>>> b = not e
>>> print b
True

Why i'm getting True here instead of False?
Because of this i can not do:
if not e:
    # here some logic
    pass

----------
components: XML
messages: 68720
nosy: xaka
severity: normal
status: open
title: invalid conversion xml.etree.ElementTree.Element object to boolean
versions: Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3195>
_______________________________________


More information about the Python-bugs-list mailing list