In early February of this year, I happened to see a tweet:
The author of fluent Python has an exciting message: he’s writing the second edition!
If you want to vote for the best Python advanced bibliography, this book will definitely be one of the most popular books. When I first wrote the “Python cat recommendation series”, I wanted to recommend it, but I thought that good things should be kept until the end, so I have been dragging it till now
If you’ve read it, you’ll certainly think it’s worth recommending; if you don’t, read on to see if my introduction can move you to make it a must read~
The English title of this book is fluent python, which was published in August 2015. Two years later, Turing education in China produced a translation, which was published in May 2017, with a score of 9.4 for Douban. (it’s a long process to translate / publish books.)
Luciano Ramalho is a Brazilian, a veteran Python programmer / speaker, and a member of the PSF (Python Software Foundation). The technical reviewers and recommenders of books include a number of big names in the circle.
As soon as this book was published, it was highly praised by the circle. Publishing houses all over the world have introduced copyright one after another. At present, there are at least nine language versions of this book :
PS: the picture is from @ fluent python, the thinnest version in simplified Chinese, coincidentally occupying the C position. According to Turing education statistics, the sales volume of simplified Chinese version exceeds 40000 copies, and it is expected to surpass that of English version in 2020.
So, what does this book really write about? What are the special features?
Python catThe official account replied.fluent, with complete HD source image)
The above is the mind map of the main chapter. The numbers in the map are the number of folded branches.
Let’s take a look at some details:
The original picture is too big to show. stay
Python catReply in official accountfluent“With complete HD source image, PDF version and markdown version
As can be seen from the chapters, this book is mainly for advanced developers. It does not involve entry-level content, but focuses on data model, data structure, function object, object-oriented, control flow and meta programming.
Opening the first chapter of the book, the author uses a few dozen lines of Python code to realize a deck of playing cards with his bare hands
import collections Card = collections.namedtuple('Card', ['rank', 'suit']) class FrenchDeck: ranks = [str(n) for n in range(2, 11)] + list('JQKA') suits = 'spades diamonds clubs hearts'.split() def __init__(self): self._cards = [Card(rank, suit) for suit in self.suits for rank in self.ranks] def __len__(self): return len(self._cards) def __getitem__(self, position): return self._cards[position]
Then, it points out the core topic of the bookA data model consisting of various special methods.
The special method is__ xxx__ () this kind of thing named before and after double underline, usually called magic method and dunder method, is a unique design of Python.
Data model is undoubtedly the key core of Python language and the cornerstone of the formation of the so-called Python style. Everything in Python is an object, and the data model is the interface specification of these objects. Because of this, python can obtain strong consistency of behavior.
Fluent Python starts with the data model and sets the tone of the full text,That is to pay attention to the construction of Python objects and the characteristics of the language details, the purpose is to let readers write more authentic, concise and efficient, readable and easy to use code.
The author of fluent Python and Chinese version
Next, it introduces python This paper introduces the features of some built-in types (sequence type, mapping type, text and byte type) in. It introduces the functions as special objects and the usage of general objects. It also introduces the control flow (iterator, generator, context manager, coroutine and concurrent programming). Finally, it goes deep into meta programming (descriptor and metaclass) which is known as black magic.
The book has more than 600 pages. It is full of rich content, which makes people feel “learned new knowledge” from time to time, and a desire of “Oh, I want to further learn XXX”.
Many students who have read the book share the same feeling: its “extended reading / random talk” is not idle writing. On the contrary, some contents are more wonderful than the text. The author shows his rich knowledge (official documents, community allusions, grammar evolution, article videos, open source projects, language differences, etc.) and each chapter is worth reading. No Python book can match it in this respect.
I recommend that you find the chapters you are interested in. In addition, some people have made very good reading notes (all very long). I put them here:
http://www.hongweipeng.com/index.php/archives/1345 （by hongweipeng）
The first edition of fluent Python was based on the latest Python 3.4 at the time. Over the years, python has been enriching itself, officially announcing the end of Python 2, and rapidly evolving to the latest version of 3.9.
However, since the author focuses on the core concepts of Python and explores the features that are basically unchanged, there is no need to worry too much about outdated content. It is still a highly recommended book to buy and read.
I’m very concerned about the second edition, but I also know that writing takes time, and English publishing, Chinese translation and Chinese publishing also need time, so let’s wait for the good news.