Master the art of writing beautiful and powerful Python by using all of the features that Python 3.5 offers
About This BookBecome familiar with the most important and advanced parts of the Python code styleLearn the trickier aspects of Python and put it in a structured context for deeper understanding of the languageOffers an expert's-eye overview of how these advanced tasks fit together in Python as a whole along with practical examplesWhat You Will LearnCreate a virtualenv and start a new projectUnderstand how and when to use the functional programming paradigmGet familiar with the different ways the decorators can be written inUnderstand the power of generators and coroutines without digressing into lambda calculusCreate metaclasses and how it makes working with Python far easierGenerate HTML documentation out of documents and code using SphinxLearn how to track and optimize application performance, both memory and cpuUse the multiprocessing library, not just locally but also across multiple machinesGet a basic understanding of packaging and creating your own libraries/applicationsIn DetailPython is a dynamic programming language. It is known for its high readability and hence it is often the first language learned by new programmers. Python being multi-paradigm, it can be used to achieve the same thing in different ways and it is compatible across different platforms. Even if you find writing Python code easy, writing code that is efficient, easy to maintain, and reuse is not so straightforward.
This book is an authoritative guide that will help you learn new advanced methods in a clear and contextualised way. It starts off by creating a project-specific environment using venv, introducing you to different Pythonic syntax and common pitfalls before moving on to cover the functional features in Python. It covers how to create different decorators, generators, and metaclasses. It also introduces you to functools.wraps and coroutines and how they work. Later on you will learn to use asyncio module for asynchronous clients and servers. You will also get familiar with different testing systems such as py.test, doctest, and unittest, and debugging tools such as Python debugger and faulthandler. You will learn to optimize application performance so that it works efficiently across multiple machines and Python versions. Finally, it will teach you how to access C functions with a simple Python call. By the end of the book, you will be able to write more advanced scripts and take on bigger challenges.
Style and ApproachThis book is a comprehensive guide that covers advanced features of the Python language, and communicate them with an authoritative understanding of the underlying rationale for how, when, and why to use them.
Table of ContentsGetting Started - One Environment per ProjectPythonic Syntax, Common Pitfalls, and Style GuideContainers and Collections - Storing Data the Right WayFunctional Programming - Readability Versus BrevityDecorators - Enabling Code Reuse by DecoratingGenerators and Coroutines - Infi nity, One Step at a TimeAsync IO - Multithreading without ThreadsMetaclasses - Making Classes (Not Instances) SmarterDocumentation - How to Use Sphinx and reStructuredTextTesting and Logging - Preparing for BugsDebu
In general, the book is very useful and worth reading. However, sometimes trivial things are explained in details but subtle aspects are mentioned very briefly. Naming convention in examples doesn't help readability: naming everything "spam" and "eggs" doesn't really reveal the purpose of methods and variables.
Intermediate level python book. It covers topics like writing C/C++ extensions, Metaclasses, Performance, Debugging, Multiprocessing, asyncio etc. Had lot of typos/wrong code but not something that you can't identify/fix if you already know the basics. Not the best but I learnt few tricks that might be useful at work.
Sharma from Packt sent me a review copy of the second edition. I skimmed it, and I like it a lot. It seems like van Hattem knows his stuff. The book is hugely inclusive and erudite; you'll almost certainly learn new things. It includes the Y combinator as an example. It isn't perfect, but it's better than Jaworski and Ziadé's book, I think, and I'll recommend it.
The second edition of Mastering Python is a hefty beast weighing in at 18 chapters and around 600 pages of content. It covers a wide range of topics in Python including philosophy, advanced class design, performance, multithreading, documentation, testing, and specialized uses of Python for data science and AI.
Note: I received a copy of this book for free as a reviewing copy from the publisher, but I have received no other compensation for this review.
This is a book that's going to best help two types of people: - If you're a few years in on Python and want to see what else the language can do, this book is going to push you to new heights - If you're coming to Python from another programming language, this will help you transfer your skills and knowledge by frequently relating concepts to concepts in other languages and orienting you to the Pythonic way of doing things.
As an expert .NET developer expanding my knowledge into Python, I fall firmly into the second profile. I learned many new aspects of Python from reading this book. Additionally, in the data science areas where I'm strongest in Python, the book surprised me by introducing me to a library or two I hadn't heard of (and now plan on using in my next project).
However, this is not a book for everyone. If you are starting out in Python, this book is too advanced for you and skips covering the basics of the Python language in lieu of a focus on more advanced areas. Start with other books, courses, and projects, then come back to this book.
My only gripes with the book are that many of the code samples are screenshots with white text on black backgrounds. On my printing this was fine, but it could lead to misprints. I also would have liked to have seen one or two quiz style questions at the end of each chapter to help cement concepts, but the book is already long enough.
This is a book at has earned its place on my bookshelf as a reference book as I continue to drill deeper into Python. I definitely recommend it, and encourage you to read it in random order in the areas most of interest to you.
На сегодняшний день для меня это самая лучшая книга по питону продвинутого уровня. Автору удалось легко и понятно объяснить многие сложные темы на замечательных примерах. Даже такие вопросы, как асинхронное программирование и метаклассы, которые везде подаются довольно запутанно, здесь раскрываются просто и элегантно. Однозначно рекомендую в связке с Лутцом для последовательного изучения данного языка программирования.
I do a lot of python programming for machine learning. I liked how there were numerous examples to try and implement in daily coding. The examples were expertly described. The author covered functional programming and multi processing and machine learning . I like the depth of topics. It is a helpful reference book to try more advanced concepts in python