If I’m not mistaken, you had to use the first approach in Python2.x, while both approaches should work in Python3.x (not sure about the exact minor versions).
For backward-compatibility reasons, you will probably see a lot of the first approach (and I’m also used to it), which wouldn’t be necessary anymore, as Python2 is dead by now.