Can't I do the same as your Haskell example, but in Python?