![Advanced Python Programming](https://img.perlego.com/book-covers/3305782/9781801817776_300_450.webp)
Advanced Python Programming
- 606 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Advanced Python Programming
About This Book
Write fast, robust, and highly reusable applications using Python's internal optimization, state-of-the-art performance-benchmarking tools, and cutting-edge librariesKey Features⢠Benchmark, profile, and accelerate Python programs using optimization tools⢠Scale applications to multiple processors with concurrent programming⢠Make applications robust and reusable using effective design patternsBook DescriptionPython's powerful capabilities for implementing robust and efficient programs make it one of the most sought-after programming languages.In this book, you'll explore the tools that allow you to improve performance and take your Python programs to the next level.This book starts by examining the built-in as well as external libraries that streamline tasks in the development cycle, such as benchmarking, profiling, and optimizing. You'll then get to grips with using specialized tools such as dedicated libraries and compilers to increase your performance at number-crunching tasks, including training machine learning models.The book covers concurrency, a major solution to making programs more efficient and scalable, and various concurrent programming techniques such as multithreading, multiprocessing, and asynchronous programming.You'll also understand the common problems that cause undesirable behavior in concurrent programs.Finally, you'll work with a wide range of design patterns, including creational, structural, and behavioral patterns that enable you to tackle complex design and architecture challenges, making your programs more robust and maintainable.By the end of the book, you'll be exposed to a wide range of advanced functionalities in Python and be equipped with the practical knowledge needed to apply them to your use cases.What you will learn⢠Write efficient numerical code with NumPy, pandas, and Xarray⢠Use Cython and Numba to achieve native performance⢠Find bottlenecks in your Python code using profilers⢠Optimize your machine learning models with JAX⢠Implement multithreaded, multiprocessing, and asynchronous programs⢠Solve common problems in concurrent programming, such as deadlocks⢠Tackle architecture challenges with design patternsWho this book is forThis book is for intermediate to experienced Python programmers who are looking to scale up their applications in a systematic and robust manner. Programmers from a range of backgrounds will find this book useful, including software engineers, scientific programmers, and software architects.
Frequently asked questions
Information
Section 1: Python-Native and Specialized Optimization
- Chapter 1, Benchmarking and Profiling
- Chapter 2, Pure Python Optimizations
- Chapter 3, Fast Array Operations with NumPy, Pandas, and Xarray
- Chapter 4, C Performance with Cython
- Chapter 5, Exploring Compilers
- Chapter 6, Automatic Differentiation and Accelerated Linear Algebra for Machine Learning
Chapter 1: Benchmarking and Profiling
- Designing your application
- Writing tests and benchmarks
- Writing better tests and benchmarks with pytest-benchmark
- Finding bottlenecks with cProfile
- Optimizing our code
- Using the dis module
- Profiling memory usage with memory_profiler
Technical requirements
Designing your application
- Make it run: We have to get the software in a working state and ensure that it produces the correct results. This exploratory phase serves to better understand the application and to spot major design issues in the early stages.
- Make it right: We want to ensure that the design of the program is solid. Refactoring should be done before attempting any performance optimization. This really helps separate the application into independent and cohesive units that are easy to maintain.
- Make it fast: Once our program is working and well structured, we can focus on performance optimization. We may also want to optimize memory usage if that constitutes an issue.
Table of contents
- Advanced Python Programming
- Second Edition
- Preface
- Section 1: Python-Native and Specialized Optimization
- Chapter 1: Benchmarking and Profiling
- Chapter 2: Pure Python Optimizations
- Chapter 3: Fast Array Operations with NumPy, Pandas, and Xarray
- Chapter 4: C Performance with Cython
- Chapter 5: Exploring Compilers
- Chapter 6: Automatic Differentiation and Accelerated Linear Algebra for Machine Learning
- Section 2: Concurrency and Parallelism
- Chapter 7: Implementing Concurrency
- Chapter 8: Parallel Processing
- Chapter 9: Concurrent Web Requests
- Chapter 10: Concurrent Image Processing
- Chapter 11: Building Communication Channels with asyncio
- Chapter 12: Deadlocks
- Chapter 13: Starvation
- Chapter 14: Race Conditions
- Chapter 15: The Global Interpreter Lock
- Section 3: Design Patterns in Python
- Chapter 16: The Factory Pattern
- Chapter 17: The Builder Pattern
- Chapter 18: Other Creational Patterns
- Chapter 19: The Adapter Pattern
- Chapter 20: The Decorator Pattern
- Chapter 21: The Bridge Pattern
- Chapter 22: The Façade Pattern
- Chapter 23: Other Structural Patterns
- Chapter 24: The Chain of Responsibility Pattern
- Chapter 25: The Command Pattern
- Chapter 26: The Observer Pattern
- Assessments
- Other Books You May Enjoy