Fluent Python, 2nd Edition

Luciano Ramalho

出版时间

2021-01-01

ISBN

9781492056331

评分

★★★★★
书籍介绍
Python’s simplicity lets you become productive quickly, but often this means you aren’t using everything it has to offer. With the updated edition of this hands-on guide, you’ll learn how to write effective, modern Python 3 code by leveraging its best ideas. Don’t waste time bending Python to fit patterns you learned in other languages. Discover and apply idiomatic Python 3 features beyond your past experience. Author Luciano Ramalho guides you through Python’s core language features and libraries and teaches you how to make your code shorter, faster, and more readable. Featuring major updates throughout the book, Fluent Python, second edition, covers: Special methods: The key to the consistent behavior of Python objects Data structures: Sequences, dicts, sets, Unicode, and data classes Functions as objects: First-class functions, related design patterns, and type hints in function declarations Object-oriented idioms: Composition, inheritance, mixins, interfaces, operator overloading, static typing and protocols Control flow: Context managers, generators, coroutines, async/await, and thread/process pools Metaprogramming: Properties, attribute descriptors, class decorators, and new class metaprogramming hooks that are simpler than metaclasses
AI导读
核心看点
  • 深入解析Python数据模型,揭示语言内部机制
  • 详解序列、字典、类等核心数据结构与特性
  • 涵盖元编程、并发及异步IO等高级主题
适合谁读
  • 希望从初级进阶到中高级的Python开发者
  • 有编程基础,想写出地道Python代码的人
  • 对Python内部原理和最佳实践感兴趣的读者
读前提醒
  • 建议结合Python 3环境边读边敲代码实践
  • 部分高阶章节较难,可先通读再针对性精读
  • 注意区分第一版与第二版在内容上的差异
读者共识
  • 公认的最佳Python进阶书籍之一,必读经典
  • 内容详实且解释清晰,能解答诸多底层疑惑
  • 部分章节如并发和元编程阅读难度较大

本导读基于书籍简介、目录、原文摘录、短评和书评生成,不等同于全文精读。

精彩摘录
  • "加州大学两位教授(Brian Harvey 和Matthew Wright)的课件 -- 两种计算机科学的教学观点: 保守观点 计算机程序在人类的思维中会变得非常庞大和复杂。因此,计算机科学教育的目的是教会人们如何训练它们的编程能力,比如以这种方式--让500个平庸的程序员聚集在一起,给出规格让他们生产出一个程序。 激进观点 计算机程序在人类的思维中会变得非常庞大和复杂。因此,计算机科学教育的目的是教会人们如何扩展自己的思维以和程序契合,学习更多的概念,将会比单一解决方法更加弹性和有用。一个程序每个单元的编程的想法都必须统观全局。"
  • "发送时要保守,接收时要大方。 ——伯斯塔尔定律,又称稳健性法则"
  • "Strong versus weak typing If the language rarely performs implicit conversion of types, it’s considered strongly typed; if it often does it, it’s weakly typed. Java, C++, and Python are strongly typed. PHP, JavaScript, and Perl are weakly typed. Static versus dynamic typing If type-checking is perfo"
  • "If a class is designed to provide method implementations for reuse by multiple unrelated subclasses, without implying an “is-a” relationship, it should be an explicit mixin class. Conceptually, a mixin does not define a new type; it merely bundles methods for reuse. A mixin should never be instantia"
  • "The second edition of Python Cookbook was written for Python 2.4, but much of its code works with Python 3, and a lot of the recipes in Chapters 5 and 6 deal with sequences. The book was edited by Alex Martelli, Anna Martelli Ravenscroft, and David Ascher, and it includes contributions by dozens of "
  • "Operating with objects regardless of their types, as long as they implement certain protocols"
  • "Changing a class or module at runtime, without touching the source code"
  • "You can think of the data model as a description of Python as a framework."
作者简介
Luciano Ramalho was a Web developer before the Netscape IPO in 1995, and switched from Perl to Java to Python in 1998. Since then he worked on some of the largest news portals in Brazil using Python, and taught Python web development in the Brazilian media, banking and government sectors. He has presented multiple talks at PyCon US, OSCON, FISL, Rupy, QCon and PythonBrasil. Ramalho is a fellow of the Python Software Foundation and co-founder of Garoa Hacker Clube, the first hackerspace in Brazil. He is co-owner of Python.pro.br, a training company.
用户评论
没看过第一版,没学过Python,正在 O'Reilly 看这个2nd Edition,阅读起来感觉很“Fluent”,内容也挺有深度~
介绍了Python的内部细节
进阶确实算进阶,一周左右读完,英文版第二版相比第一版来说,整体添加内容感觉不到10%,最后3章内容比较高阶一些,平时也比较少涉略,读起来确实有点费劲,整体感觉python本身思想还是有点乱,天马行空,没有c++和java那么严谨,所以语法会让你觉得很别扭。
看了网络上流传出来的未正式定稿的第二版,第二版作者应该是打算大幅度更新的,但是出版社那边应该是有页数限制,所以有一部分是放到了网页中,在ebook中是看不到的,内容很棒,描述清晰细致,并发以及异步io那块估计还得找专门的书再了解一下。这本书以及learning python那本书,是深入了解python绕不过去的书,只可惜lp那本书的作者不打算更新了。
这本更符合我目前的需求,也可以作为官方文档之外的资料查阅(我能吐槽一下 python 的官方文档还有可以提升的空间吗)。 2022.6.24 差点错过这本好书!即使不打算深入 python,这本书旁征博引的编程思想也很值得一学。P.S. 有几章是跳着看的,并发那一块比起具体代码(反正以后也不大可能用 Python 写相关逻辑)我更想看老人家怎么吐槽 Python GIL。
很好的python进阶读物,推荐
很多干货,加深python的认识,很多最新版本的特性也有更新
收藏