Functional programming in Python