Advanced Python Programming Accelerate your Python programs using proven techniques and design patterns

Write fast, robust, and highly reusable applications using Python’s internal optimization, state-of-the-art performance-benchmarking tools, and cutting-edge libraries Key Features Benchmark, profile, and accelerate Python programs using optimization toolsScale applications to multiple processors wit...

Celý popis

Uloženo v:
Podrobná bibliografie
Hlavní autor: Nguyen, Quan
Médium: E-kniha
Jazyk:angličtina
Vydáno: Birmingham Packt Publishing 2022
Packt Publishing, Limited
Packt Publishing Limited
Vydání:2
Témata:
On-line přístup:Získat plný text
Tagy: Přidat tag
Žádné tagy, Buďte první, kdo vytvoří štítek k tomuto záznamu!
Abstract Write fast, robust, and highly reusable applications using Python’s internal optimization, state-of-the-art performance-benchmarking tools, and cutting-edge libraries Key Features Benchmark, profile, and accelerate Python programs using optimization toolsScale applications to multiple processors with concurrent programmingMake applications robust and reusable using effective design patterns Book Description Python'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 XarrayUse Cython and Numba to achieve native performanceFind bottlenecks in your Python code using profilersOptimize your machine learning models with JAXImplement multithreaded, multiprocessing, and asynchronous programsSolve common problems in concurrent programming, such as deadlocksTackle architecture challenges with design patterns Who this book is for This 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.
AbstractList Write fast, robust, and highly reusable applications using Python’s internal optimization, state-of-the-art performance-benchmarking tools, and cutting-edge libraries Key Features Benchmark, profile, and accelerate Python programs using optimization toolsScale applications to multiple processors with concurrent programmingMake applications robust and reusable using effective design patterns Book Description Python'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 XarrayUse Cython and Numba to achieve native performanceFind bottlenecks in your Python code using profilersOptimize your machine learning models with JAXImplement multithreaded, multiprocessing, and asynchronous programsSolve common problems in concurrent programming, such as deadlocksTackle architecture challenges with design patterns Who this book is for This 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.
Author Nguyen, Quan
Author_xml – sequence: 1
  fullname: Nguyen, Quan
BookMark eNpVjztPw0AQhA8JECS4pIEmHaII3PmeLoMVHlIkUiBa63y7ZwJ-wNkB5d9zyDSZZnekb3c0E3LYdi0Scs7oDY26zbRhhjLDtNbqgCR7_phMGKeKKi20PCFJ37_HG84kz1JzSi4X8G1bhzBb74a3rp2tQ1cF2zSbtjojR97WPSb_c0pe75cv-eN89fzwlC9Wc8sEF2YOBqjWQgkqhVTcGYPAAKjhXlgProxZBh1QpywiamoVh9RDSaX3ngGfkuvx8Y-tBwyAVdju4lI0Nrhir05kr0b2M3RfW-yHAsuu-3DYDsHWxfIuV1nKpOSRvBjJTQwt_qC-YJQpzpXmv0f_WHo
ContentType eBook
Copyright 2022 Packt Publishing
Copyright_xml – notice: 2022 Packt Publishing
DEWEY 005.72
DOI 10.0000/9781801817776
DatabaseTitleList
DeliveryMethod fulltext_linktorsrc
Discipline Computer Science
EISBN 9781801817776
1801817774
Edition 2
ExternalDocumentID 9781801817776
EBC6921553
10163367
GroupedDBID -VX
5O.
AABBV
AAFKH
AAKGN
AANYM
AAZEP
AAZGR
ABIWA
ABMRC
ABQNV
ABRSK
ABWNX
ACBYE
ACMFT
ACNAM
ACXXF
ADBND
AECLD
AEDWI
AEHEP
AEIUR
AEMZR
AETWE
AFQEX
AHWGJ
ALMA_UNASSIGNED_HOLDINGS
APVFW
ATDNW
BBABE
BPBUR
BSWCA
CZZ
DUGUG
DYXOI
E2F
EBSCA
ECNEQ
ECOWB
IIUVB
K-E
KT4
L7C
OHILO
OODEK
QD8
TD3
UE6
XI1
ID FETCH-LOGICAL-a14348-d8d077464054563c88ed1dd083f4afdcb5398ecd0c6aeee70a63d2fdb05fff1d3
IngestDate Fri Nov 21 21:41:26 EST 2025
Tue Nov 11 23:49:10 EST 2025
Sun Jun 29 07:32:11 EDT 2025
IsPeerReviewed false
IsScholarly false
LCCallNum_Ident QA76.73.P98 N489 2022
Language English
LinkModel OpenURL
MergedId FETCHMERGED-LOGICAL-a14348-d8d077464054563c88ed1dd083f4afdcb5398ecd0c6aeee70a63d2fdb05fff1d3
OCLC 1306067475
PQID EBC6921553
PageCount 606
ParticipantIDs walterdegruyter_marc_9781801817776
proquest_ebookcentral_EBC6921553
ieee_books_10163367
PublicationCentury 2000
PublicationDate 2022
[2022]
PublicationDateYYYYMMDD 2022-01-01
PublicationDate_xml – year: 2022
  text: 2022
PublicationDecade 2020
PublicationPlace Birmingham
PublicationPlace_xml – name: Birmingham
– name: Birmingham, UK
PublicationYear 2022
Publisher Packt Publishing
Packt Publishing, Limited
Packt Publishing Limited
Publisher_xml – name: Packt Publishing
– name: Packt Publishing, Limited
– name: Packt Publishing Limited
RestrictionsOnAccess restricted access
SSID ssj0003153928
Score 2.2586875
Snippet Write fast, robust, and highly reusable applications using Python’s internal optimization, state-of-the-art performance-benchmarking tools, and cutting-edge...
SourceID walterdegruyter
proquest
ieee
SourceType Publisher
SubjectTerms Application software
COMPUTERS / CD-ROM Technology
COMPUTERS / Client-Server Computing
COMPUTERS / Computer Literacy
Computing and Processing
Development
Python (Computer program language)
Subtitle Accelerate your Python programs using proven techniques and design patterns
TableOfContents Table of Contents Benchmarking and ProfilingPure Python OptimizationsFast Array Operations with NumPy and PandasC Performance with CythonExploring CompilersAutomatic Differentiation and Accelerated Linear Algebra for Machine LearningImplementing ConcurrencyParallel ProcessingConcurrent Web RequestsConcurrent Image ProcessingBuilding Communication Channels with asyncioDeadlocksStarvationRace ConditionsThe Global Interpreter LockThe Factory PatternThe Builder PatternOther Creational PatternsThe Adapter PatternThe Decorator PatternThe Bridge PatternThe Façade PatternOther Structural PatternsThe Chain of Responsibility PatternThe Command PatternThe Observer Pattern
Cover -- Title Page -- Copyright and credits -- Contributors -- About the reviewers -- Table of Contents -- Preface -- Section 1: Python-Native and Specialized Optimization -- Chapter 1: Benchmarking and Profiling -- Technical requirements -- Designing your application -- Building a particle simulator -- Visualizing the simulation -- Writing tests and benchmarks -- Timing your benchmark -- Writing better tests and benchmarks with pytest-benchmark -- Finding bottlenecks with cProfile -- Graphically analyzing profiling results -- Profiling line by line with line_profiler -- Optimizing our code -- Using the dis module -- Profiling memory usage with memory_profiler -- Summary -- Questions -- Further reading -- Chapter 2: Pure Python Optimizations -- Technical requirements -- Using the right algorithms and data structures -- Lists and deques -- Dictionaries -- Sets -- Heaps -- Tries -- Improved efficiency with caching and memoization -- Joblib -- Efficient iteration with comprehensions and generators -- Summary -- Questions -- Further reading -- Chapter 3: Fast ArrayOperations withNumPy, Pandas,and Xarray -- Technical requirement -- Getting started with NumPy -- Creating arrays -- Accessing arrays -- Broadcasting -- Mathematical operations -- Calculating the norm -- Rewriting the particle simulator in NumPy -- Reaching optimal performance with numexpr -- Working with database-style data with pandas -- pandas fundamentals -- Database-style operations with pandas -- High-performance labeled data with xarray -- Analyzing concentration -- The xarray library -- Improved performance -- Plotting with xarray -- Chapter 4: C Performance with Cython -- Technical requirements -- Compiling Cython extensions -- Adding static types -- Declaring variables -- Declaring functions -- Declaring classes -- Sharing declarations -- Working with arrays
C arrays and pointers -- Working with NumPy arrays -- Working with typed memoryviews -- Using a particle simulator in Cython -- Profiling Cython -- Using Cython with Jupyter -- Summary -- Questions -- Chapter 5: Exploring Compilers -- Technical requirements -- Getting started with Numba -- Using Numba decorators -- Type specializations -- Object mode versus native mode -- Numba and NumPy -- JIT classes -- Limitations in Numba -- The PyPy project -- Setting up PyPy -- Running a particle simulator in PyPy -- Other interesting projects -- Summary -- Questions -- Further reading -- Chapter 6: Automatic Differentiation and Accelerated Linear Algebra for Machine Learning -- A crash course in machine learning -- Model parameters -- Loss function -- Loss minimization -- Getting JAX up and running -- Installing JAX -- Using Google Colab -- Automatic differentiation for loss minimization -- Making the dataset -- Building a linear model -- Gradient descent with automatic differentiation -- Just-In-Time compilation for improved efficiency -- Automatic vectorization for efficient kernels -- Data that is not linearly separable -- The kernel method in machine learning -- Automatic vectorization for kernelized models -- Summary -- Questions -- Further reading -- Section 2: Concurrency and Parallelism -- Chapter 7: Implementing Concurrency -- Technical requirements -- Asynchronous programming -- Waiting for input/output -- Concurrency -- Callbacks -- Futures -- Event loops -- The asyncio framework -- Coroutines -- Converting blocking code into non-blocking code -- Reactive programming -- Observables -- Useful operators -- Hot and cold observables -- Building a CPU monitor -- Summary -- Questions -- Further reading -- Chapter 8: Parallel Processing -- Technical requirements -- Introduction to parallel programming -- GPUs -- Using multiple processes
Section 3: Design Patterns in Python -- Chapter 16: The Factory Pattern -- Technical requirements -- Understanding design patterns -- Implementing the factory method -- Real-world examples -- Use cases -- Implementing the factory method -- Applying the abstract factory -- Real-world examples -- Use cases -- Implementing the abstract factory pattern -- Summary -- Questions -- Chapter 17: The Builder Pattern -- Technical requirements -- Understanding the builder pattern -- Real-world examples -- Use cases -- Implementing an ordering application -- Summary -- Questions -- Chapter 18: Other Creational Patterns -- Technical requirements -- Implementing the prototype pattern -- Real-world examples -- Use cases -- Implementation -- Implementing the singleton pattern -- Real-world examples -- Use cases -- Implementation -- Summary -- Questions -- Further reading -- Chapter 19: The Adapter Pattern -- Technical requirements -- Understanding the adapter pattern -- Real-world examples -- Use cases -- Implementation -- Summary -- Chapter 20: The Decorator Pattern -- Technical requirements -- Introducing the decorator pattern -- Real-world examples -- Use cases -- Implementation -- Summary -- Questions -- Chapter 21: The Bridge Pattern -- Technical requirements -- Real-world examples -- Use cases -- Implementation -- Summary -- Questions -- Chapter 22: The Façade Pattern -- Technical requirements -- Understanding the façade pattern -- Real-world examples -- Use cases -- Implementation -- Summary -- Questions -- Further reading -- Chapter 23: Other Structural Patterns -- Technical requirements -- Implementing the flyweight pattern -- Real-world examples -- Use cases -- Implementation -- Implementing the model-view-controller pattern -- Real-world examples -- Use cases -- Implementation -- Applying the proxy pattern -- Real-world examples -- Use cases
The Process and Pool classes -- The Executor interface -- Monte Carlo approximation of pi -- Synchronization and locks -- Parallel Cython with OpenMP -- Automatic parallelism -- Getting started with Theano -- Profiling Theano -- TensorFlow -- Running code on a GPU -- Summary -- Questions -- Chapter 9: Concurrent Web Requests -- The basics of web requests -- HTML -- HTTP requests -- HTTP status code -- The requests module -- Making a request in Python -- Running a ping test -- Concurrent web requests -- Spawning multiple threads -- Refactoring request logic -- The problem with timeouts -- Support from httpstat.us and simulation in Python -- Timeout specifications -- Good practices in making web requests -- Consider the terms of service and data-collecting policies -- Error handling -- Update your program regularly -- Avoid making a large number of requests -- Summary -- Questions -- Further reading -- Chapter 10: Concurrent Image Processing -- Technical requirements -- Image processing fundamentals -- Python as an image processing tool -- Computer image basics -- OpenCV API -- Image processing techniques -- Applying concurrency to image processing -- Good concurrent image processing practices -- Choosing the correct way (out of many) -- Spawning an appropriate number of processes -- Processing input/output concurrently -- Summary -- Questions -- Further reading -- Chapter 11: Building Communication Channels with asyncio -- Technical requirements -- The ecosystem of communication channels -- Communication protocol layers -- Asynchronous programming for communication channels -- Transports and protocols in asyncio -- The big picture of asyncio's server client -- Getting started with Python and Telnet -- Starting a server -- Installing Telnet -- Simulating a connection channel -- Sending messages back to clients -- Closing transports
Client-side communication with aiohttp -- Installing aiohttp and aiofiles -- Fetching a website's HTML code -- Writing files asynchronously -- Summary -- Questions -- Further reading -- Chapter 12: Deadlocks -- Technical requirements -- The concept of deadlocks -- The dining philosophers problem -- A deadlock in a concurrent system -- Python simulation -- Approaches to deadlock situations -- Implementing ranking among resources -- Ignoring locks and sharing resources -- The concept of livelocks -- Summary -- Questions -- Further reading -- Chapter 13: Starvation -- Technical requirements -- Understanding starvation -- What is starvation? -- Scheduling -- Causes of starvation -- Starvation's relationship to deadlock -- Approaching the readers-writers problem -- Problem statement -- The first readers-writers problem -- The second readers-writers problem -- The third readers-writers problem -- Solutions to starvation -- Summary -- Questions -- Further reading -- Chapter 14: Race Conditions -- Technical requirements -- The concept of race conditions -- Critical sections -- How race conditions occur -- Simulating race conditions in Python -- Locks as a solution to race conditions -- The effectiveness of locks -- Implementation in Python -- The downside of locks -- Race conditions in real life -- Security -- Operating systems -- Networking -- Summary -- Questions -- Further reading -- Chapter 15: The Global Interpreter Lock -- Technical requirements -- Introducing the GIL -- Analyzing memory management in Python -- The problem that the GIL addresses -- Problems raised by the GIL -- The potential removal of the GIL from Python -- Working with the GIL -- Implementing multiprocessing, rather than multithreading -- Getting around the GIL with native extensions -- Utilizing a different Python interpreter -- Summary -- Questions -- Further reading
Implementation
Advanced Python Programming: Accelerate your Python programs using proven techniques and design patterns
Title Advanced Python Programming
URI https://ieeexplore.ieee.org/servlet/opac?bknumber=10163367
https://ebookcentral.proquest.com/lib/[SITE_ID]/detail.action?docID=6921553
hasFullText 1
inHoldings 1
isFullTextHit
isPrint
link http://cvtisr.summon.serialssolutions.com/2.0.0/link/0/eLvHCXMwtV3NS8MwFA-6efDix1ScUyki3optkrXp1TERhDFhyG6lbRIRsc6t1e2_97023Ucv4sFLaENJmvceyS_Je-9HyLVyJOA2TBsKWNXmkRa2cF1ly4CBxiXXqisLsgl_MBDjcTA0nHizgk7AT1MxnweTf1U11IGyMXT2D-peNgoV8AxKhxLUDmUNES9fjb9xdZ0_XGBCAIwBQNer92pxwiPfl3xRzjNPuTELs-OntLbjH0bJW7Z2SlVu4NejocrNoSswGZfvl_wq9akSF6rSO2Lzu1r26f5dzwsokgvdTD5tJOvCS23DXLJNmpR3GXpSPo748miLwSwaUFFmNMV-bjd6MTw2G5B-77twDpDqZZovsuoyuljjRwekqTDw45BsqbRF9iu6C8vMfkekUwnYKgVsrQn4mDzf90e9B9twS9gRIEQubCmkA9DXA8AKGJIlQijpSgmIVIPFyiSGMQiVSCfxIvhb34k8JqmWsdPVWruSnZBG-pGqU2JprgDXOTwRFLOqqjiGtqDNwI04lTRukxYOOESrmBU-dYx5fptY1fjD4mLceOOGK5G3yVVNLiEmOAk3xHn2ezsdsruyo3PSyKa5uiA7yVf2OpteFsr7AVV3Hw0
linkProvider Knovel
openUrl ctx_ver=Z39.88-2004&ctx_enc=info%3Aofi%2Fenc%3AUTF-8&rfr_id=info%3Asid%2Fsummon.serialssolutions.com&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.title=Advanced+Python+Programming&rft.au=Nguyen%2C+Quan&rft.date=2022-01-01&rft.pub=Packt+Publishing%2C+Limited&rft.isbn=9781801817776&rft_id=info:doi/10.0000%2F9781801817776&rft.externalDocID=EBC6921553