Book Image

Daniel Arbuckle's Mastering Python

By : Daniel Arbuckle
Book Image

Daniel Arbuckle's Mastering Python

By: Daniel Arbuckle

Overview of this book

Daniel Arbuckle's Mastering Python covers the basics of operating in a Python development environment, before moving on to more advanced topics. Daniel presents you with real-world solutions to Python 3.6 and advanced-level concepts, such as reactive programming, microservices, ctypes, and Cython tools. You don't need to be familiar with the Python language to use this book, as Daniel starts with a Python primer. Throughout, Daniel highlights the major aspects of managing your Python development environment, shows you how to handle parallel computation, and helps you to master asynchronous I/O with Python 3.6 to improve performance. Finally, Daniel will teach you the secrets of metaprogramming and unit testing in Python, helping you acquire the perfect skillset to be a Python expert. Daniel will get you up to speed on everything from basic programming practices to high-end tools and techniques, things that will help set you apart as a successful Python programmer.
Table of Contents (13 chapters)

The difference between asynchronous processing and parallel processing

When we worked with the concurrent.futures module in Chapter 6, Parallel Processing, we saw a way to make two or more streams of code run at the same time. For reference, have a look at the code example we used in the previous chapter:

This code helps you create an executor object. Now if you ever wish to run some code in parallel, you could just tell the executor to do it. The executor would give us a future object that we could use later to get the result of the code, and it would then run the code in a separate process. Our original code will keep on running in the original process.

We talked about how this could improve the performance of CPU-bound programs—it divides the code into multiple computer cores. Therefore, it's a technique that would be convenient in a lot of other circumstances...