3 ms·
That's generally considered unpythonic though. A more pythonic way to write that is for child in node.children if node.children else []: for attrib
by Doxin 8y ago
That's generally considered unpythonic though. A more pythonic way to write that is
for child in node.children if node.children else []:
for attrib in child.attributes if child.attributes else []:
...
Which, granted, is a lot more verbose and probably not any more readable but at least it's not abusing the or operator.