Functional Programming in Python: A Guide to writing beautiful One-Liners and significantly Shorter code

Nitin Kishore Sai Samala (~snknitin)


5

Votes

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.

  1. Introduction to Functional Programming (2 minutes)
    • Understanding functional programming principles
    • Benefits of functional programming in Python
    • Comparison with imperative programming
  2. The Magic of Python Lambdas (2 minutes)
    • Unleashing the power of anonymous functions (lambdas)
    • Leveraging lambda functions for concise expressions
  3. List Comprehensions Reimagined (1 minute)
    • Transforming data and Enhancing readability with concise list comprehensions
  4. Mapping and Filtering with Ease (1 minutes)
    • Utilizing map() and filter() for functional transformations
    • Replacing loops with efficient and elegant mapping and filtering
  5. Reducing Complexity with functools (2 minutes)
    • Exploring powerful functional tools in the functools module
    • Simplifying complex tasks with reduce(), partial(), and more
  6. Functional Programming with itertools (2 minutes)
    • Harnessing the potential of the itertools module for functional tasks
    • Combining iterators and generators for efficient one-liners
  7. 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
  8. Functional Techniques for Data Manipulation (1 minutes)
    • Applying functional programming to manipulate data structures
    • Simplifying complex data operations with functional approaches
  9. 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
  10. 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
  11. Mastering One-Liners: Tips and Tricks (2 minutes)
    • Best practices for writing clear and maintainable one-liners
    • Debugging and testing strategies for one-liners
  12. 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
  13. 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:

  1. A love for coding
    1. 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.

Section: Core Python
Type: Talks
Target Audience: Beginner
Last Updated: