Library Hours
Monday to Friday: 9 a.m. to 9 p.m.
Saturday: 9 a.m. to 5 p.m.
Sunday: 1 p.m. to 9 p.m.
Naper Blvd. 1 p.m. to 5 p.m.
     
Results Page:  Previous Next
Author Lott, Steven F., author.

Title Functional Python programming : use a functional approach to write succinct, expressive, and efficient Python code / Steven F. Lott ; foreword by Ricardo Banffy. [O'Reilly electronic resource]

Edition Third edition.
Publication Info. Birmingham : Packt Publishing, [2022]
©2022
QR Code
Description 1 online resource (576 pages)
Series Expert insight
Expert insight.
Summary Python isn't all about object-oriented programming. Discover a valuable way of thinking about code design through a function-first approach - and learn when you need to use it. Now with detailed exercises at the end of every chapter! Purchase of the print or Kindle book includes a free eBook in PDF format. Key Features Learn how, when, and why to adopt functional elements in your projects Explore the Python modules essential to functional programming, like itertools and functools Revised to cover new features of Python 3.10, exercises at the end of every chapter, and more Book Description Not enough developers understand the benefits of functional programming, or even what it is. Author Steven Lott demystifies the approach, teaching you how to improve the way you code in Python and make gains in memory use and performance. Starting from the fundamentals, this book shows you how to apply functional thinking and techniques in a range of scenarios, with examples centered around data cleaning and exploratory data analysis. You'll learn how to use generator expressions, list comprehensions, and decorators to your advantage. You don't have to abandon object-oriented design completely, though - you'll also see how Python's native object-orientation is used in conjunction with functional programming techniques. By the end of this book, you'll be well versed in the essential functional programming features of Python, and understand why and when functional thinking helps. You'll also have all the tools you need to pursue any additional functional topics that are not part of the Python language. What you will learn Use Python's libraries to avoid the complexities of state-changing classes Leverage built-in higher-order functions to avoid rewriting common algorithms Write generator functions to create lazy processing Design and implement decorators for functional composition Make use of Python type annotations to describe parameters and results of functions Apply functional programming to concurrency and web services Explore the PyMonad library for stateful simulations Who this book is for The functional paradigm is very useful for programmers working in data science, but any Python developer who wants to create more reliable, succinct, and expressive code will have much to learn from this book. No prior knowledge of functional programming is required to get started, though Python programming knowledge is assumed. A running Python environment is essential.
Contents Cover -- Copyright -- Contributors -- Table of Contents -- Preface -- Chapter 1: Understanding Functional Programming -- The functional style of programming -- Comparing and contrasting procedural and functional styles -- Using the functional paradigm -- Using a functional hybrid -- The stack of turtles -- A classic example of functional programming -- Exploratory data analysis -- Summary -- Exercises -- Convert an imperative algorithm to functional code -- Convert step-wise computation to functional code -- Revise the sqrt() function -- Data cleansing steps
(Advanced) Optimize this functional code -- Chapter 2: Introducing Essential Functional Concepts -- Functions as first-class objects -- Pure functions -- Higher-order functions -- Immutable data -- Strict and non-strict evaluation -- Lazy and eager evaluation -- Recursion instead of an explicit loop state -- Functional type systems -- Familiar territory -- Learning some advanced concepts -- Summary -- Exercises -- Apply map() to a sequence of values -- Function vs. lambda design question -- Optimize a recursion -- Chapter 3: Functions, Iterators, and Generators -- Writing pure functions
Functions as first-class objects -- Using strings -- Using tuples and named tuples -- Using generator expressions -- Exploring the limitations of generators -- Combining generator expressions -- Cleaning raw data with generator functions -- Applying generators to built-in collections -- Generators for lists, dicts, and sets -- Using stateful mappings -- Using the bisect module to create a mapping -- Using stateful sets -- Summary -- Exercises -- Rewrite the some_function() function -- Alternative Mersenne class definition -- Alternative algorithm implementations -- Map and filter
Dictionary comprehension -- Raw data cleanup -- Chapter 4: Working with Collections -- An overview of function varieties -- Working with iterables -- Parsing an XML file -- Parsing a file at a higher level -- Pairing up items from a sequence -- Using the iter() function explicitly -- Extending an iteration -- Applying generator expressions to scalar functions -- Using any() and all() as reductions -- Using len() and sum() on collections -- Using sums and counts for statistics -- Using zip() to structure and flatten sequences -- Unzipping a zipped sequence -- Flattening sequences
Structuring flat sequences -- Structuring flat sequences -- an alternative approach -- Using sorted() and reversed() to change the order -- Using enumerate() to include a sequence number -- Summary -- Exercises -- Palindromic numbers -- Hands of cards -- Replace legs() with pairwise() -- Chapter 5: Higher-Order Functions -- Using max() and min() to find extrema -- Using Python lambda forms -- Lambdas and the lambda calculus -- Using the map() function to apply a function to a collection -- Working with lambda forms and map() -- Using map() with multiple sequences
Subject Python (Computer program language)
Functional programming (Computer science)
Python (Langage de programmation)
Programmation fonctionnelle.
Functional programming (Computer science)
Python (Computer program language)
Added Author Bánffy, Ricardo, writer of foreword.
Other Form: Print version: 9781803232577
ISBN 9781803236568 (ebook)
1803236566
Patron reviews: add a review
Click for more information
EBOOK
No one has rated this material

You can...
Also...
- Find similar reads
- Add a review
- Sign-up for Newsletter
- Suggest a purchase
- Can't find what you want?
More Information