Python: Functional Programming - What, When and How?
Farhaan Bukhsh (~farhaanbukhsh) |
This is an intermediate level talk, that’ll help the audience appreciate the Functional Programming Paradigm and how it can be helpful in the day to day scripts that we write. It’ll also touch upon how the concept of functional programming can help elevate the thought process.
What can folks expect?
- To learn what the functional programming paradigm is.
- To develop the thought process of thinking “functionally.”
- How python can be used to write functional code
- How day to day work can be made quick and easy
The focus of the talk
What is functional programming? - 10 mins
This segment comprises of exploring what first class objects are and how we’ve been conditioned to think that just variables can be taken as first class objects. Then we move on to explore how even functions can be considered first class objects, and what prime features need be followed to be able to say that functions are first class objects.
What are first class objects? - 5 mins
This segment explains what first class objects actually are and gives a really brief introduction on what makes variables or functions be treated as first class objects. This also include a live coding section, explaining how functions can be:
- Assigned to a variable
- Passed as a parameter
- Returned from another function
How does Python fit in? - 10 mins
This section showcases the different utilities python inherently provides to support functional programming. It explains how map, filter and reduce, fit in and used in our daily habit of writing code.
This also will be accompanied by live code examples and scenarios that we face regularly. We dive a little into partials and look at the tip of the iceberg called decorators.
The Whys and Wherefores of Functional Programming - 5 mins
This is a segment about various real life experiences; situations where functional programming can be the right tool and where this should be a total no, no. Like they say “Right horses for the right courses”, this segment will cover where not to use functional programming and when this debate shouldn’t be brought up. This segment will also cover what is the best place to bring in functional programming and its benefits.
You should have
A basic Knowledge of Python
Written about 1000 lines in Python
A curiosity to learn more and get better
Functional Programming Blog:
Took inspiration from Mary Rose Cook and her blog which moved me to write Functional Code
Farhaan is a Software Developer at Clootrack, a Bangalore base startup. He also contributes to FOSS projects and is lucky enough to have few documentation patch in Core Python. He used to heavily contribute to Pagure and still trying to make time to do the same. He actively maintains a blog and indulges in online discussion on twitter.
He mentors students to contribute to Open Source Projects, he is also actively involved with Dgplug and is always up on IRC to have a quick discussion.