Secret Recipes for the Python Ninja: Over 50 recipes that uncover powerful programming tactics in Python
Test your Python programming skills by solving real world programming problems covered in the book
- Work your way through the standard library and engineer your applications based on appropriate implementations of the library,
- Discover how to make the best use of decorators, context managers, coroutines and generator functions,
- Enhance speed and improve concurrency by conjuring up tricks from the Pypy project.
Do you feel you've mastered the Python language and you know everything it takes to write applications that are class apart? Well, you're in for a surprise! This book covers the darkest secrets of Python, delving into its depths and uncovering things you never would have thought could be done.
You'll unearth secrets related to the implementation of the standard library, looking at how the modules actually work. Understanding the implementation of collections, decimal, and fractions modules, along with collections.abc and numbers will surely enable you to do much more than you thought possible. If you haven't used decorators, context managers, coroutines, and generator functions enough, you'll learn from their recipes, what you've been missing out on. We'll cover Internal special methods in detail, showing you what they are and how exactly they can be used to improve the engineering decisions you make. Moving on, you'll explore the CPython interpreter, which is a treasure trove of secret hacks that not many programmers have ventured to understand. We'll take you through the depths of the Pypy project where you'll come across several exciting ways that you can use to improve speed and concurrency.
Finally, we'll take the time to explore the PEPs of the latest versions to excavate some interesting hacks.
What You Will Learn
- Differences between .py files and .pyc files
- Find out about the different ways to install and upgrade Python packages
- The working of the PyPi module that enhances built-in decorators
- Learn how coroutines are different from generators and how they can simulate multithreading
- How the decimal module improves on floating point numbers and its operations
- Standardizing subinterpreters to improve concurrency
- Discovering Python's built-in docstring analyzer
Who This Book Is For
Whether you've been working with Python for a few years or you're a seasoned snake wrangler, you'll have a lot of new tricks to walk away with.