Functional Programming in Python: A Guide to writing beautiful One-Liners and significantly Shorter code
Nitin Kishore Sai Samala (~snknitin) |
Description:
Python's versatility and conciseness make it a powerful language for data manipulation, analysis, and problem-solving. Functional programming is a paradigm that allows developers to write elegant and expressive code by focusing on functions as first-class citizens. In this illuminating talk, we will explore the world of functional programming in Python, demystifying the concept of one-liners β succinct, powerful expressions that perform complex tasks in a single line of code.
The talk will commence with an introduction to functional programming, explaining its core principles, benefits, and how it differs from imperative programming. We will then dive into the art of crafting one-liners, showcasing a collection of intriguing and efficient examples that highlight the simplicity and readability of functional programming.
- Introduction to Functional Programming (2 minutes)
- Understanding functional programming principles
- Benefits of functional programming in Python
- Comparison with imperative programming
- The Magic of Python Lambdas (2 minutes)
- Unleashing the power of anonymous functions (lambdas)
- Leveraging lambda functions for concise expressions
- List Comprehensions Reimagined (1 minute)
- Transforming data and Enhancing readability with concise list comprehensions
- Mapping and Filtering with Ease (1 minutes)
- Utilizing
map()
andfilter()
for functional transformations - Replacing loops with efficient and elegant mapping and filtering
- Utilizing
- Reducing Complexity with
functools
(2 minutes)- Exploring powerful functional tools in the
functools
module - Simplifying complex tasks with
reduce()
,partial()
, and more
- Exploring powerful functional tools in the
- Functional Programming with
itertools
(2 minutes)- Harnessing the potential of the
itertools
module for functional tasks - Combining iterators and generators for efficient one-liners
- Harnessing the potential of the
- Power of
Complex Numbers
: From Fundamental Mathematics to Practical problem solving- Complex numbers are not merely abstract entities; they hold immense potential for a wide range of applications beyond their mathematical roots.
- Key
mathematical properties and insights
- Graph traversals, tree operations, hashmap manipulations, and heap operations
- Functional Techniques for Data Manipulation (1 minutes)
- Applying functional programming to manipulate data structures
- Simplifying complex data operations with functional approaches
- Elegant Error Handling with
try-except
(1 minutes)- Writing concise and robust error-handling code using
try-except
blocks - Avoiding nested blocks for cleaner exception handling
- Writing concise and robust error-handling code using
- Beyond List: Functional Programming with Other Data Structures (3 minutes)
- Exploring functional programming with dictionaries, sets, and tuples
- Reducing boilerplate code with expressive one-liners
- Mastering One-Liners: Tips and Tricks (2 minutes)
- Best practices for writing clear and maintainable one-liners
- Debugging and testing strategies for one-liners
- Real-World Applications of Functional One-Liners (2 minutes)
- Showcasing how functional one-liners solve common programming challenges
- Demonstrating their efficiency in data science, algorithmic tasks, and web development
- Key Takeaways and Embracing Functional Programming (2 minutes)
- Recap of the power and simplicity of functional one-liners
- Encouragement to embrace functional programming for elegant and concise code
The audience will leave this talk with a newfound appreciation for functional programming in Python and the art of crafting powerful one-liners. Armed with practical knowledge and real-world examples, attendees will be inspired to adopt functional programming techniques, enhancing their code readability, reducing complexity, and ultimately becoming more effective Python developers. Join us on this journey to unravel the secrets of functional programming and unlock the magic of one-liners!
Prerequisites:
- A love for coding
- Curiosity to learn and improve your Python skills
Speaker Info:
A Jack-of-all-trades with a Masters in Computer Science
and a Minor in Data Science. I graduated from UMASS Amherst
in 2018 and am currently working as a Staff Data Scientist @ Walmart Labs
. My undergrad was done from BITS Pilani
. I love solving puzzles/ciphers, deductive reasoning and tackling real-world challenges that require learning and combining different concepts.
My name is a palindrome, and Iβm a polymath and a polyglot (First Language is Pythonπ ). I aim to be an expert generalist across all the subfields and domains of AI, and I am perpetually working towards it. Life is a constant struggle between being a member of the community and standing out as an individual. I find a balance between both. Iβm not big on introductions because actions speak louder, and I believe people should grind until they no longer have to introduce themselves.
Speaker Links:
I have delivered 2 talks prior to this -
1) RE-WORK Applied AI Summit, San Francisco, Jan 2020.
2) Walmart AI Summit, Bangalore, April 2022.
You can find the links to these here- https://snknitin.github.io/talks/
Some additional redirects for the intrigued :
π Website
π Blogs
π€ Open Source Contribution
π±βπ» Github
βοΈ LinkedIn.