3 ms·
Or simply node.left, node.right = map(invert, (node.right, node.left))
by aldanor 8y ago
Or simply
node.left, node.right = map(invert, (node.right, node.left))
- quietbritishjim 8y agoCoalescing those four lines onto one is fine, but writing: map(invert, (node.right, node.left)) is definitely not simpler than: invert(node.right), invert(node.left)
- peterkelly 8y agoIndeed - I just wanted to write it in a form that could easily be mapped to languages which don't support multiple simultaneous assignments :)