For DFS, two lines will be too much!

return [] if not root else [root.val]+self.preorderTraversal(root.left)+self.preorderTraversal(root.right)