An indispensable collection of practical tips and real-world advice for tackling common Python problems and taking your code to the next level. Features interviews with high-profile Python developers who share their tips, tricks, best practices, and real-world advice gleaned from years of experience.

Sharpen your Python skills as you dive deep into the Python programming language with Serious Python. You'll cover a range of advanced topics like multithreading and memorization, get advice from experts on things like designing APIs and dealing with databases, and learn Python internals to help you gain a deeper understanding of the language itself. Written for developers and experienced programmers, Serious Python brings together over 15 years of Python experience to teach you how to avoid common mistakes, write code more efficiently, and build better programs in less time.

As you make your way through the book's extensive tutorials, you'll learn how to start a project and tackle topics like versioning, layouts, coding style, and automated checks. You'll learn how to package your software for distribution, optimize performance, use the right data structures, define functions efficiently, pick the right libraries, build future-proof programs, and optimize your programs down to the bytecode. You'll also learn how to:

- Make and use effective decorators and methods, including abstract, static, and class methods- Employ Python for functional programming using generators, pure functions, and functional functions- Extend flake8 to work with the abstract syntax tree (AST) to introduce more sophisticated automatic checks into your programs- Apply dynamic performance analysis to identify bottlenecks in your code- Work with relational databases and effectively manage and stream data with PostgreSQL

If you've been looking for a way to take your Python skills from good to great, Serious Python will help you get there. Learn from the experts and get seriously good at Python with Serious Python!

Product description

Product Description

An indispensable collection of practical tips and real-world advice for tackling common Python problems and taking your code to the next level. Features interviews with high-profile Python developers who share their tips, tricks, best practices, and real-world advice gleaned from years of experience.

Sharpen your Python skills as you dive deep into the Python programming language with Serious Python. You'll cover a range of advanced topics like multithreading and memorization, get advice from experts on things like designing APIs and dealing with databases, and learn Python internals to help you gain a deeper understanding of the language itself. Written for developers and experienced programmers, Serious Python brings together over 15 years of Python experience to teach you how to avoid common mistakes, write code more efficiently, and build better programs in less time.

As you make your way through the book's extensive tutorials, you'll learn how to start a project and tackle topics like versioning, layouts, coding style, and automated checks. You'll learn how to package your software for distribution, optimize performance, use the right data structures, define functions efficiently, pick the right libraries, build future-proof programs, and optimize your programs down to the bytecode. You'll also learn how to:

- Make and use effective decorators and methods, including abstract, static, and class methods- Employ Python for functional programming using generators, pure functions, and functional functions- Extend flake8 to work with the abstract syntax tree (AST) to introduce more sophisticated automatic checks into your programs- Apply dynamic performance analysis to identify bottlenecks in your code- Work with relational databases and effectively manage and stream data with PostgreSQL

If you've been looking for a way to take your Python skills from good to great, Serious Python will help you get there. Learn from the experts and get seriously good at Python with Serious Python!

About the Author

Julien Danjou is a Principal Software Engineer at Red Hat and a contributor to OpenStack, the largest existing open source project written in Python. He has been a Free Software and Open Source hacker for the past 15 years.

No customer reviews

Review this product

Most helpful customer reviews on Amazon.com

Amazon.com:
5.0 out of 5 stars
2 reviews

Mike Driscoll

5.0 out of 5 starsCovers topics that most Python books don't!

9 March 2019 - Published on Amazon.com

Serious Python is an interesting book. Let’s tart with chapter 1, which is about starting your project. This chapter covers the dos and don’ts of laying out your code project. You learn about version numbering and automated checks. Each chapter ends with an interview with someone in the Python community. For chapter 1, the interview is with Joshua Harlow.

Chapter 2 digs into modules, libraries and frameworks. Here you get an overview of how Python’s import system works. The author spends a couple of pages listing out useful standard libraries and also talks about using external libraries too. He even mentions safety practices when downloading from external resources and you learn about pip.

For chapter 3, you learn about writing good documentation and API with Sphinx. This chapter focuses almost exclusively on the Sphinx framework, which is what the Python team uses to document Python itself. You will learn about Sphinx modules and writing your own extensions to Sphinx here.

In chapter 4, the topic is timestamps and time zones. You will learn how to use Python’s datetime library as well as the super cool dateutil module, which is an external module for Python. The author also spends some time talking about serializing datetime objects and solving ambiguous times.

The topic of distributing your software is front and center in chapter 5. Here you will learn about using setup.py, setup.cfg and the wheel format. You will also discover how entry points work!

For chapter 6, you will dig into unit testing with Python’s unittest module. Julien cover regular unittest as well as mocks and then gets into how to use the tox automation project.

If you have been interested in decorators, static methods or class methods, then chapter 7 is for you. The entire chapter is devoted to these types of code constructs and goes one to talk about abstract methods too!

In chapter 8, Julien teaches the reader how useful Python is for doing functional programming. He focuses on generators, list comprehensions and Python’s builtins, such as map(), filter() and enumerate() among others.

The abstract syntax tree is the topic of choice for chapter 9. You will learn how to writing a program using AST as well as Hy, which is a dialect of Lisp that is embedded in Python. You can learn more about that project here. There is also a section about extending flake8 with AST.

For chapter 10, you will learn about performance and optimization. Here the author uses Python’s cProfile and the dis module to understand the behavior of your programs. The rest of the chapter covers various optimization techniques, such as using memoization, PyPy, buffers, etc.

In chapter 11, you will learn about scaling and architecture. The title of the chapter is a bit opaque in my opinion, as the actual topic is concurrency. Here you learn about Python threads, processes and asyncio. He also talks a little about ZeroMQ.

If you happen to be interesting in learning how Python works with relational databases, then you’ll want to check out chapter 12. Here the author talks about various database backends and shows an example of using Flask with PostgreSQL.

Finally in chapter 13, Julien covers using the six module to support writing your code for both Python 2 and 3. He also covers single dispatch and context managers in this chapter and then wraps it up by talking about the attrs package.

While some of topics that are covered seem pretty obvious, I don’t actually see very many authors or bloggers talking about them all that often. For example, I only hear about scaling on rare occasions and even concurrency articles don’t come out all that often. The only real fault I can think of here is that I might have arranged the chapters in a slightly different order than the way they ended up. I would give the book a chance and check it out if you’d like to learn more about any of the above topics!