舉報

會員
Daniel Arbuckle's Mastering Python
最新章節:
Summary
IfyouareaprogrammerandarefamiliarwiththebasicsofPython,andyouwanttobroadenyourknowledgebasetodevelopprojectsbetterandfaster,thisbookisforyou.EvenifyouarenotfamiliarwithPython,DanielArbuckle'sMasteringPythonstartswiththebasicsandtakesyouonajourneytobecomeanexpertinthetechnology.
最新章節
- Summary
- Compiling an extension module in Python
- Using cpdef in a Cython class
- Methods to increase the execution speed of Python code
- Writing extension modules in Cython
- Additional import methods in Cython
品牌:中圖公司
上架時間:2021-07-02 18:36:31
出版社:Packt Publishing
本書數字版權由中圖公司提供,并由其授權上海閱文信息技術有限公司制作發行
- Summary 更新時間:2021-07-02 21:10:27
- Compiling an extension module in Python
- Using cpdef in a Cython class
- Methods to increase the execution speed of Python code
- Writing extension modules in Cython
- Additional import methods in Cython
- Working with Cython
- Interfacing with C code using Cython
- Providing data structure layouts
- Providing a function signature
- Using a pointer as a parameter of a function
- Assigning attributes to a function
- Accessing functions defined in the library
- Locating and linking a dynamic library
- Accessing a dynamic library using ctypes
- The downsides of compiled code
- Advantages and disadvantages of compiled code
- Extension Modules and Compiled Code
- Summary
- Interacting with a microservice by creating another microservice
- Interacting with a microservice manually using the nameko shell
- Interacting with our microservice
- Things to know before using nameko
- Running and connecting a microservice using nameko
- Installing nameko
- Building high-level microservices with nameko
- Test running the microservice
- Running and connecting to our microservice using Flask
- Making Flask handle a request
- Building a microservice to maintain a database
- Creating endpoints for a RESTful API in Flask
- Installing Flask
- Building high-level microservices with Flask
- Applying the microservice architecture to web servers
- Advantages of the microservice architecture
- Microservices and the advantages of process isolation
- Microservices
- Summary
- The where factory method
- Empty return_value and from_iterable factory methods
- The Observable.select_many method
- The Observable.create method
- Miscellaneous observable factory methods
- Combining and processing observable sequences
- Creating an asyncio scheduler
- Explaining the observable sequence of events
- Observable factory methods
- Translating our zoo demo into Rx
- Using the reactive extensions for Python (RxPY)
- Composing an observable sequence
- Illustrating a stream of animal events
- Building the observable sequence
- Emitting events
- Observables
- Observers
- Building a simple reactive programming framework
- The concept of reactive programming
- Reactive Programming
- Summary
- Testing multiple worker processes
- The cover-package option
- Running our tests with nose
- Using nose for unified test discovery and reporting
- Command-line options in unit test discovery
- Unittest's discovery tool
- Using unittest's test discovery
- The unittest.mock patch function
- assert methods of mock objects
- Preconfiguring mock objects
- What is a mock object?
- Using unittest.mock
- Comparing what happens to what should happen in unit tests
- assert methods
- Structuring a test file
- Using the unittest package
- What is a unit test?
- Understanding the principle of unit testing
- Unit Testing
- Summary
- Writing descriptors as classes
- Using @property to create a descriptor
- Descriptors
- Creating an asynchronous-coroutine-based context manager
- Synchronous-coroutine-based context managers
- Adding context manager behavior to a class
- Defining a context manager as a generator
- Context managers
- The __new__ method
- The __prepare__method
- What can we do with a metaclass?
- Metaclasses
- Class definitions
- The factory_constructed function
- The factory function
- Modifying class attributes
- Class decorators
- Inspecting the package signature function
- Keyword arguments
- Annotations as input to function decorators
- The @no_type_check decorator
- Accessing annotation data
- Function annotation syntax
- Function annotations
- The only function
- The @wraps decorator
- Enclosing the function in a wrapper
- Attributes
- Global decorator - @staticmethod
- Using the @ syntax in a function decorator
- Using function decorators
- Metaprogramming
- Summary
- Handling client disconnections
- Creating a simple server in asyncio
- Creating a simple client in asyncio
- Communicating across the network
- Queue types
- The asyncio Queue class
- The gather coroutine
- The wait_for coroutine
- The wait coroutine
- Synchronization primitives
- Synchronizing multiple tasks
- Asynchronous iterations
- asyncio's future objects
- Awaiting data availability
- Closing event_loop
- The run_forever/run_until_complete methods
- ensure_future
- The asyncio scheduler - event_loop
- Creating a coroutine
- Using the asyncio event loop and coroutine scheduler
- The coroutine scheduler
- Python coroutines
- Cooperative coroutine scheduler versus coroutine
- Multithreading is not good for servers
- The difference between asynchronous processing and parallel processing
- Coroutines and Asynchronous I/O
- Summary
- The semaphore object
- The condition object
- The event object
- The lock object
- Manager
- Pipes
- Queues
- Process class in the multiprocessing module
- Using the multiprocessing packages
- The cancel method
- The add done callback function
- The wait and as_completed functions
- The done and result methods
- Using the submit method
- Using the map method
- Calling ProcessPoolExecutor
- The concurrent.futures module
- Using the concurrent.futures package
- Parallel Processing
- Summary
- Creating launches for our program
- Setting up a shell script or batch file to launch the program
- Finishing up our code example
- The wait method
- The PIPE constant
- Using the Popen subprocess
- Subprocess and its variants
- Executing other programs with subprocess
- The Pipeline user interface
- The cmd class
- The pprint package
- The getpass package
- Python's built-in functions - print and input
- Python tools to interact with the user
- nargs
- Setting the name of argument
- Creating an ArgumentParser object
- Handling command-line arguments with argparse
- Pipeline program
- Making a package executable via Python -m
- Making a Command-Line Utility
- Summary
- What it means when a code example fails
- Testing examples using doctest
- Using doctest to test documentation examples
- Turning docstrings into HTML
- Sphinx
- PEP 257 and docutils
- Getting the most out of docstrings
- pip in virtual environments
- Activating a virtual environment
- Creating a virtual environment
- Using venv to create a stable and isolated work area
- The pull command
- The mergetool command
- Merging codes
- Branches
- Undoing the changes
- Committing the changes in Git
- Initializing Git
- Using version control
- Naming conventions
- Formatting recommendations
- Code indentation
- PEP 8 — guidelines for Python code
- PEP 8 and writing readable code
- Basic Best Practices
- Summary
- Adding static data files to the package
- Resolving attribute errors raised due to cyclic dependencies
- Importing a cyclic dependency
- Accessing code from other modules
- The Package structure and interface
- Module loading with namespace packages
- Adding modules to the package
- Importing all package modules
- Turning a regular folder into a package
- Creating an empty package
- Making a Package
- Summary
- Legalities and licenses of the Python Package Index
- Searching the Package Index with pip
- Using Package Index
- Using keywords
- Finding packages in the Python Package Index
- Managing installed packages
- The pip tool for packages
- Installing packages with pip
- Python interactive shell
- Opening a command-line window
- Using the command line and the interactive shell
- Installing Python
- Choosing a suitable version
- Downloading and installing Python
- Setting Up
- Summary
- Other changes in Python packages
- Changes in packages
- The changes in the syntactic
- What's new in modern Python
- Different types of packages
- The standard library
- Attributes
- The defaultdict class
- First-class functions and classes
- Comprehension
- Set
- Tuple
- List
- Dictionaries
- Python's built-in data structures and comprehensions
- Indentation
- Flow control statements
- Classes
- Expressions
- Variables
- Functions
- Basic building blocks
- Python basic syntax and block structure
- Python Primer
- Questions
- Piracy
- Errata
- Downloading the example code
- Customer support
- Reader feedback
- Conventions
- Who this book is for
- What you need for this book
- What this book covers
- Preface
- Customer Feedback
- Why subscribe?
- www.PacktPub.com
- About the Author
- Credits
- Title Page
- coverpage
- coverpage
- Title Page
- Credits
- About the Author
- www.PacktPub.com
- Why subscribe?
- Customer Feedback
- Preface
- What this book covers
- What you need for this book
- Who this book is for
- Conventions
- Reader feedback
- Customer support
- Downloading the example code
- Errata
- Piracy
- Questions
- Python Primer
- Python basic syntax and block structure
- Basic building blocks
- Functions
- Variables
- Expressions
- Classes
- Flow control statements
- Indentation
- Python's built-in data structures and comprehensions
- Dictionaries
- List
- Tuple
- Set
- Comprehension
- First-class functions and classes
- The defaultdict class
- Attributes
- The standard library
- Different types of packages
- What's new in modern Python
- The changes in the syntactic
- Changes in packages
- Other changes in Python packages
- Summary
- Setting Up
- Downloading and installing Python
- Choosing a suitable version
- Installing Python
- Using the command line and the interactive shell
- Opening a command-line window
- Python interactive shell
- Installing packages with pip
- The pip tool for packages
- Managing installed packages
- Finding packages in the Python Package Index
- Using keywords
- Using Package Index
- Searching the Package Index with pip
- Legalities and licenses of the Python Package Index
- Summary
- Making a Package
- Creating an empty package
- Turning a regular folder into a package
- Importing all package modules
- Adding modules to the package
- Module loading with namespace packages
- The Package structure and interface
- Accessing code from other modules
- Importing a cyclic dependency
- Resolving attribute errors raised due to cyclic dependencies
- Adding static data files to the package
- Summary
- Basic Best Practices
- PEP 8 and writing readable code
- PEP 8 — guidelines for Python code
- Code indentation
- Formatting recommendations
- Naming conventions
- Using version control
- Initializing Git
- Committing the changes in Git
- Undoing the changes
- Branches
- Merging codes
- The mergetool command
- The pull command
- Using venv to create a stable and isolated work area
- Creating a virtual environment
- Activating a virtual environment
- pip in virtual environments
- Getting the most out of docstrings
- PEP 257 and docutils
- Sphinx
- Turning docstrings into HTML
- Using doctest to test documentation examples
- Testing examples using doctest
- What it means when a code example fails
- Summary
- Making a Command-Line Utility
- Making a package executable via Python -m
- Pipeline program
- Handling command-line arguments with argparse
- Creating an ArgumentParser object
- Setting the name of argument
- nargs
- Python tools to interact with the user
- Python's built-in functions - print and input
- The getpass package
- The pprint package
- The cmd class
- The Pipeline user interface
- Executing other programs with subprocess
- Subprocess and its variants
- Using the Popen subprocess
- The PIPE constant
- The wait method
- Finishing up our code example
- Setting up a shell script or batch file to launch the program
- Creating launches for our program
- Summary
- Parallel Processing
- Using the concurrent.futures package
- The concurrent.futures module
- Calling ProcessPoolExecutor
- Using the map method
- Using the submit method
- The done and result methods
- The wait and as_completed functions
- The add done callback function
- The cancel method
- Using the multiprocessing packages
- Process class in the multiprocessing module
- Queues
- Pipes
- Manager
- The lock object
- The event object
- The condition object
- The semaphore object
- Summary
- Coroutines and Asynchronous I/O
- The difference between asynchronous processing and parallel processing
- Multithreading is not good for servers
- Cooperative coroutine scheduler versus coroutine
- Python coroutines
- The coroutine scheduler
- Using the asyncio event loop and coroutine scheduler
- Creating a coroutine
- The asyncio scheduler - event_loop
- ensure_future
- The run_forever/run_until_complete methods
- Closing event_loop
- Awaiting data availability
- asyncio's future objects
- Asynchronous iterations
- Synchronizing multiple tasks
- Synchronization primitives
- The wait coroutine
- The wait_for coroutine
- The gather coroutine
- The asyncio Queue class
- Queue types
- Communicating across the network
- Creating a simple client in asyncio
- Creating a simple server in asyncio
- Handling client disconnections
- Summary
- Metaprogramming
- Using function decorators
- Using the @ syntax in a function decorator
- Global decorator - @staticmethod
- Attributes
- Enclosing the function in a wrapper
- The @wraps decorator
- The only function
- Function annotations
- Function annotation syntax
- Accessing annotation data
- The @no_type_check decorator
- Annotations as input to function decorators
- Keyword arguments
- Inspecting the package signature function
- Class decorators
- Modifying class attributes
- The factory function
- The factory_constructed function
- Class definitions
- Metaclasses
- What can we do with a metaclass?
- The __prepare__method
- The __new__ method
- Context managers
- Defining a context manager as a generator
- Adding context manager behavior to a class
- Synchronous-coroutine-based context managers
- Creating an asynchronous-coroutine-based context manager
- Descriptors
- Using @property to create a descriptor
- Writing descriptors as classes
- Summary
- Unit Testing
- Understanding the principle of unit testing
- What is a unit test?
- Using the unittest package
- Structuring a test file
- assert methods
- Comparing what happens to what should happen in unit tests
- Using unittest.mock
- What is a mock object?
- Preconfiguring mock objects
- assert methods of mock objects
- The unittest.mock patch function
- Using unittest's test discovery
- Unittest's discovery tool
- Command-line options in unit test discovery
- Using nose for unified test discovery and reporting
- Running our tests with nose
- The cover-package option
- Testing multiple worker processes
- Summary
- Reactive Programming
- The concept of reactive programming
- Building a simple reactive programming framework
- Observers
- Observables
- Emitting events
- Building the observable sequence
- Illustrating a stream of animal events
- Composing an observable sequence
- Using the reactive extensions for Python (RxPY)
- Translating our zoo demo into Rx
- Observable factory methods
- Explaining the observable sequence of events
- Creating an asyncio scheduler
- Combining and processing observable sequences
- Miscellaneous observable factory methods
- The Observable.create method
- The Observable.select_many method
- Empty return_value and from_iterable factory methods
- The where factory method
- Summary
- Microservices
- Microservices and the advantages of process isolation
- Advantages of the microservice architecture
- Applying the microservice architecture to web servers
- Building high-level microservices with Flask
- Installing Flask
- Creating endpoints for a RESTful API in Flask
- Building a microservice to maintain a database
- Making Flask handle a request
- Running and connecting to our microservice using Flask
- Test running the microservice
- Building high-level microservices with nameko
- Installing nameko
- Running and connecting a microservice using nameko
- Things to know before using nameko
- Interacting with our microservice
- Interacting with a microservice manually using the nameko shell
- Interacting with a microservice by creating another microservice
- Summary
- Extension Modules and Compiled Code
- Advantages and disadvantages of compiled code
- The downsides of compiled code
- Accessing a dynamic library using ctypes
- Locating and linking a dynamic library
- Accessing functions defined in the library
- Assigning attributes to a function
- Using a pointer as a parameter of a function
- Providing a function signature
- Providing data structure layouts
- Interfacing with C code using Cython
- Working with Cython
- Additional import methods in Cython
- Writing extension modules in Cython
- Methods to increase the execution speed of Python code
- Using cpdef in a Cython class
- Compiling an extension module in Python
- Summary 更新時間:2021-07-02 21:10:27