Functional Python Programming: Discover the power of functional programming, generator functions, lazy evaluation, the built-in itertools library, and monads, 2/e
暫譯: 函數式 Python 程式設計:探索函數式程式設計、生成器函數、延遲評估、內建 itertools 函式庫及單子,第二版

Steven F. Lott

買這商品的人也買了...

相關主題

商品描述

Create succinct and expressive implementations with functional programming in Python

Key Features

  • Learn how to choose between imperative and functional approaches based on expressiveness, clarity, and performance
  • Get familiar with complex concepts such as monads, concurrency, and immutability
  • Apply functional Python to common Exploratory Data Analysis (EDA) programming problems

Book Description

If you're a Python developer who wants to discover how to take the power of functional programming (FP) and bring it into your own programs, then this book is essential for you, even if you know next to nothing about the paradigm.

Starting with a general overview of functional concepts, you'll explore common functional features such as first-class and higher-order functions, pure functions, and more. You'll see how these are accomplished in Python 3.6 to give you the core foundations you'll build upon. After that, you'll discover common functional optimizations for Python to help your apps reach even higher speeds.

You'll learn FP concepts such as lazy evaluation using Python's generator functions and expressions. Moving forward, you'll learn to design and implement decorators to create composite functions. You'll also explore data preparation techniques and data exploration in depth, and see how the Python standard library fits the functional programming model. Finally, to top off your journey into the world of functional Python, you'll at look at the PyMonad project and some larger examples to put everything into perspective.

What you will learn

  • Use Python's generator functions and generator expressions to work with collections in a non-strict (or lazy) manner
  • Utilize Python library modules including itertools, functools, multiprocessing, and concurrent features to ensure efficient functional programs
  • Use Python strings with object-oriented suffix notation and prefix notation
  • Avoid stateful classes with families of tuples
  • Design and implement decorators to create composite functions
  • Use functions such as max(), min(), map(), filter(), and sorted()
  • Write higher-order functions

Who This Book Is For

This book is for Python developers who would like to perform Functional programming with Python. Python Programming knowledge is assumed.

Table of Contents

  1. Understanding Functional Programming
  2. Introducing essential functional concepts
  3. Functions, Iterators and Generators
  4. Working with Collections
  5. Higher-Order Functions
  6. Recursions and Reductions
  7. Additional tuple techiques
  8. The Itertools Module
  9. More Itertools Techniques
  10. The Functools Module
  11. Decorator Design Techniques
  12. The Multiprocessing and Threading Modules
  13. The Operator Module
  14. The PyMonad Library
  15. A Functional Approach to Web Services
  16. Optimizations and Improvements

商品描述(中文翻譯)

**使用 Python 的函數式編程創建簡潔且表達力強的實現**

**主要特點**

- 學習如何根據表達性、清晰性和性能在命令式和函數式方法之間進行選擇
- 熟悉單子(monads)、並發性(concurrency)和不可變性(immutability)等複雜概念
- 將函數式 Python 應用於常見的探索性數據分析(Exploratory Data Analysis, EDA)編程問題

**書籍描述**

如果你是一位希望發掘函數式編程(Functional Programming, FP)力量並將其帶入自己程式的 Python 開發者,那麼這本書對你來說是必不可少的,即使你對這一範式幾乎一無所知。

本書從函數式概念的一般概述開始,探索常見的函數式特性,如一級函數(first-class functions)和高階函數(higher-order functions)、純函數(pure functions)等。你將看到這些如何在 Python 3.6 中實現,為你提供基礎知識。接下來,你將發現 Python 的常見函數式優化,幫助你的應用達到更高的速度。

你將學習使用 Python 的生成器函數和表達式進行懶惰評估(lazy evaluation)的 FP 概念。隨著進展,你將學會設計和實現裝飾器(decorators)來創建組合函數(composite functions)。你還將深入探索數據準備技術和數據探索,並了解 Python 標準庫如何適應函數式編程模型。最後,為了讓你在函數式 Python 的世界中更具全局觀,你將查看 PyMonad 專案和一些更大的範例,以便將所有內容放在正確的視角中。

**你將學到的內容**

- 使用 Python 的生成器函數和生成器表達式以非嚴格(或懶惰)方式處理集合
- 利用 Python 的庫模組,包括 itertools、functools、multiprocessing 和 concurrent 特性,以確保高效的函數式程式
- 使用帶有物件導向後綴表示法和前綴表示法的 Python 字串
- 避免使用帶狀態的類別,改用元組(tuple)系列
- 設計和實現裝飾器以創建組合函數
- 使用 max()、min()、map()、filter() 和 sorted() 等函數
- 編寫高階函數

**本書適合對象**

本書適合希望使用 Python 進行函數式編程的 Python 開發者。假設讀者具備 Python 編程知識。

**目錄**

1. 理解函數式編程
2. 介紹基本的函數式概念
3. 函數、迭代器和生成器
4. 處理集合
5. 高階函數
6. 遞迴和歸約
7. 其他元組技術
8. itertools 模組
9. 更多 itertools 技術
10. functools 模組
11. 裝飾器設計技術
12. multiprocessing 和 threading 模組
13. operator 模組
14. PyMonad 庫
15. 函數式網路服務方法
16. 優化和改進