Functional Python Programming - Third Edition: Use a functional approach to write succinct, expressive, and efficient Python code (功能性 Python 程式設計(第三版):以函數式方法撰寫簡潔、表達力強且高效的 Python 代碼)

Lott, Steven F.

  • 出版商: Packt Publishing
  • 出版日期: 2022-12-30
  • 售價: $1,650
  • 貴賓價: 9.5$1,568
  • 語言: 英文
  • 頁數: 576
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 1803232579
  • ISBN-13: 9781803232577
  • 相關分類: Python程式語言
  • 立即出貨 (庫存=1)

相關主題

商品描述

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.

商品描述(中文翻譯)

Python不僅僅是面向對象編程。通過以函數為先的方法,探索一種有價值的代碼設計思維方式,並學習何時需要使用它。現在每章末尾都有詳細的練習題!

購買印刷版或Kindle電子書,將包含一本免費的PDF格式電子書。

主要特點:

- 學習在項目中採用函數元素的方法、時間和原因
- 探索對函數式編程至關重要的Python模塊,如itertools和functools
- 修訂以涵蓋Python 3.10的新功能,每章末尾都有練習題等

書籍描述:

不夠多的開發人員了解函數式編程的好處,甚至不知道它是什麼。作者Steven Lott揭開了這種方法的神秘面紗,教你如何改進在Python中編碼的方式,並在內存使用和性能方面取得收益。

從基礎知識開始,本書向你展示如何在各種場景中應用函數式思維和技術,並以數據清理和探索性數據分析為中心的示例為例。你將學習如何利用生成器表達式、列表推導和裝飾器來獲得優勢。然而,你不必完全放棄面向對象的設計 - 你還將看到Python的本地面向對象如何與函數式編程技術結合使用。

通過閱讀本書,你將熟悉Python的基本函數式編程特性,並了解函數式思維何時以及為何有助於編程。你還將擁有所有必要的工具,以追求Python語言中不屬於的任何其他函數式主題。

你將學到什麼:

- 使用Python的庫來避免狀態變化類的複雜性
- 利用內置的高階函數來避免重寫常見算法
- 編寫生成器函數以創建惰性處理
- 設計和實現裝飾器進行函數組合
- 利用Python類型註釋描述函數的參數和結果
- 將函數式編程應用於並發和Web服務
- 探索PyMonad庫進行有狀態的模擬

本書適合對數據科學工作的程序員非常有用,但任何想要創建更可靠、簡潔和表達性代碼的Python開發人員都可以從本書中學到很多。

開始之前不需要對函數式編程有任何先備知識,但需要具備Python編程知識。運行Python環境是必不可少的。

目錄大綱

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. Complex Stateless Objects
8. The Itertools Module
9. Itertools for Combinatorics - Permutations and Combinations
10. The Functools Module
11. The Toolz Package
12. Decorator Design Techniques
13. The PyMonad Library
14. The Multiprocessing, Threading, and Concurrent.Futures Modules
15. A Functional Approach toWeb Services
16. A Chi-Squared Case Study

目錄大綱(中文翻譯)

1. 理解函數式編程
2. 介紹基本的函數式概念
3. 函數、迭代器和生成器
4. 處理集合
5. 高階函數
6. 遞歸和歸納
7. 複雜的無狀態對象
8. Itertools 模組
9. Itertools 用於組合數學 - 排列和組合
10. Functools 模組
11. Toolz 套件
12. 裝飾器設計技巧
13. PyMonad 函式庫
14. Multiprocessing、Threading 和 Concurrent.Futures 模組
15. 以函數式方法處理網絡服務
16. 卡方檢定案例研究