LEADER 06958nam 22005413 450 001 9911007242703321 005 20230113102848.0 010 $a9781523151417 010 $a1523151412 010 $a9781803232577 010 $a1803232579 035 $a(CKB)5680000000297174 035 $a(OCoLC)1357496464 035 $a(OCoLC-P)1357496464 035 $a(CaSebORM)9781803232577 035 $a(EXLCZ)995680000000297174 100 $a20230110d2022 uy 0 101 0 $aeng 135 $aurcnu|||unuuu 181 $ctxt$2rdacontent 182 $cc$2rdamedia 183 $acr$2rdacarrier 200 10$aFunctional Python programming $euse a functional approach to write succinct, expressive, and efficient Python code /$fSteven F. Lott ; foreword by Ricardo Banffy 205 $aThird edition. 210 1$aBirmingham :$cPackt Publishing,$d[2022] 210 4$dİ2022 215 $a1 online resource (576 pages) 225 1 $aExpert insight 327 $aCover -- 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 327 $a(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 327 $aFunctions 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 327 $aDictionary 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 327 $aStructuring 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 330 $aPython 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. 410 0$aExpert insight. 606 $aPython (Computer program language) 606 $aFunctional programming (Computer science) 615 0$aPython (Computer program language) 615 0$aFunctional programming (Computer science) 676 $a005.133 700 $aLott$b Steven F.$01107378 702 $aB?nffy$b Ricardo 801 0$bOCoLC-P 801 1$bOCoLC-P 906 $aBOOK 912 $a9911007242703321 996 $aFunctional Python programming$94388761 997 $aUNINA