事实证明,如果
Element对象
False没有子对象,则将其视为值。
我在源代码中找到了这个:
def __nonzero__(self): warnings.warn( "The behavior of this method will change in future versions. " "Use specific 'len(elem)' or 'elem is not None' test instead.", FutureWarning, stacklevel=2 ) return len(self._children) != 0 # emulate old behaviour, for now
甚至内联注释也与您相同-这种行为很不明智;)



