Fluent Python

Author: Luciano Ramalho
Publisher: O'Reilly
Pages: 770
ISBN: 978-1491946008
Print: 1491946008
Kindle: B0131L3PW4
Audience: People who already program in Python
Rating: 5
Reviewer: Mike James 

This book was amoung our Best Books of 2015. If you missed this recommendation first time around, here's another chance to discover why it should be on your bookshelf.

 

This substantial tome is not about the fluent programming style so common in other languages, but about becoming fluent, i.e. an expert. As such it isn't for the complete beginner, but for everyone else the conclusion is just go out and buy a copy. If you write Python then you will enjoy reading this book and get a lot from it - I will now explain why and what. 

The only real problem with Fluent Python is its title as it really doesn't give the prospective reader any idea what to expect. I can't really complain too much because if pushed I'd have a hard time coming up with a title that tells you much either - perhaps Expert Python or Inside Python but these don't quite get it either. 

There also is an issues with terminology in other places in the book. For example the first section of the book is called The Python Data Model. Which is fine if you are a serious Pythonista but if you "just write programs" you might find confusing. The Data Model is more what would be called the Object Model in other languages. The author does explain this, but not until quite late on - which might leave some innocents wondering when data is going to come into the story.

 

Banner

 

The whole first part of the book is essentially about the special methods and you will understand Python much better after reading it. 

All of the chapters have examples that illustrate the ideas or the problems that some feature of Python attempts to solve. These usually amount to personal notes and recollections from the author of who did what and why in the Python community. It all helps to make you feel more part of the whole. If you have only "just used" Python then it also makes you see that it isn't the random collection of language features that some criticise it for being. 

Part II is on Data Structures and covers sequences, tuples, dictionaries, sets and text and bytes. At the end of reading it you will no longer be mystified as to why Python has tuples and Unicode will no longer frighten you - ok it will but not quite as much. 

Part III is called Functions as Objects and it covers why any language, Python in particular that has first class functions needs to do things differently. We start off with a discussion of what a first class function is and then move on to how this changes the classical design patterns. This is deep and certainly deserves to be better known. A lot of it applies to other languages notably JavaScript. 

Part IV continues the theme of looking at the way objects are used with a look at Object-Oriented Idioms. We start off with a topic that is a pet subject of mine - variables are not boxes. This brings out the distinction between a value and a reference. If you think in terms of variables being references then everything makes sense. This I agree with but I still prefer to think of variables as boxes that store things - just they store different types of things, values and references. There is, of course, a lot more than this in this section - interfaces, multiple inheritance, operator overloading an more. 

 

 

 

Part V is called Control Flow and it deals with what you might call non-standard alternatives to control statements. Python supports iterables, iterators and generators which are familiar from other languages but it also has context managers, coroutines, futures and async which are arguably not so common. 

The final part of the book is called Metaprogramming but you might be forgiven for thinking that much of the earlier part of the book was a bit "meta". In this case the meaning is how you can implement dynamic properties and attributes and make use of metaclasses. 

fluentpython

This is a very simple book to review because it is almost uniformly good - a rare thing in the world of programming books. I'm not saying that you won't disagree with what the author says, but in doing so you will learn a lot and have fun. About the only thing bad I can say about this book is that it is big and has a tendency to fall apart, which is a shame as it is a "keeper". 

If you are an intelligent Python programmer just buy a copy and spend the next year reading it. 

 

 

For more Python titles see Books for Pythonistas a roundup of our reviews about this language at intermediate level

 

Banner
 


Software Development Pearls

Author: Karl Wiegers
Publisher: Addison-Wesley Professional
Pages: 336
ISBN: 978-0137487776
Print: 0137487770
Kindle: B09BF6CS9T
Audience: General developers
Rating: 2
Reviewer: Ian Elliot
Who can resist a good pearl or two?



SQL Server 2022 Query Performance Tuning (Apress)

Author: Grant Fritchey
Publisher: Apress
Pages: 745
ISBN:978-1484288900
Print:1484288904
Kindle:B0BLYD98SQ
Audience: DBAs & SQL Devs
Rating: 4.7
Reviewer: Ian Stirk 

A popular performance tuning book gets updated for SQL Server 2022, how does it fare?


More Reviews

 

Last Updated ( Friday, 11 August 2017 )