Alex Martelli, Anna Martelli Ravenscroft, Steve Holden, Paul McGuire
——Mark Summerfield

由公认的Python专家精心策划,新版专注于3.10版本,完全展现了Python语言取得的最新开创性成果,涵盖了最近发布的Python 3.11。
● 学习Python如何将数据和程序表示为对象
● 理解类型注解的价值和用途
● 考察最新版本中出现的各种语言特性
● 揭示如何地道地运用现代Python
● 学习适当地搭建Python项目
● 理解如何测试、调试和优化Python代码
  1. Preface
  2. 1. Introduction to Python
  3. The Python Language
  4. The Python Standard Library and Extension Modules
  5. Python Implementations
  6. Python Development and Versions
  7. Python Resources
  8. Installation
  9. Installing Python from Binaries
  10. Installing Python from Source Code
  11. 2. The Python Interpreter
  12. The python Program
  13. Python Development Environments
  14. Running Python Programs
  15. Running Python in the Browser
  16. 3. The Python Language
  17. Lexical Structure
  18. Data Types
  19. Variables and Other References
  20. Expressions and Operators
  21. Numeric Operations
  22. Sequence Operations
  23. Set Operations
  24. Dictionary Operations
  25. Control Flow Statements
  26. Functions
  27. 4. Object-Oriented Python
  28. Classes and Instances
  29. Special Methods
  30. Decorators
  31. Metaclasses
  32. 5. Type Annotations
  33. History
  34. Type-Checking Utilities
  35. Type Annotation Syntax
  36. The typing Module
  37. Using Type Annotations at Runtime
  38. How to Add Type Annotations to Your Code
  39. Summary
  40. 6. Exceptions
  41. The try Statement
  42. The raise Statement
  43. The with Statement and Context Managers
  44. Generators and Exceptions
  45. Exception Propagation
  46. Exception Objects
  47. Custom Exception Classes
  48. ExceptionGroup and except*
  49. Error-Checking Strategies
  50. The assert Statement
  51. 7. Modules and Packages
  52. Module Objects
  53. Module Loading
  54. Packages
  55. Distribution Utilities (distutils) and setuptools
  56. Python Environments
  57. 8. Core Built-ins and Standard Library Modules
  58. Built-in Types
  59. Built-in Functions
  60. The sys Module
  61. The copy Module
  62. The collections Module
  63. The functools Module
  64. The heapq Module
  65. The argparse Module
  66. The itertools Module
  67. 9. Strings and Things
  68. Methods of String Objects
  69. The string Module
  70. String Formatting
  71. Text Wrapping and Filling
  72. The pprint Module
  73. The reprlib Module
  74. Unicode
  75. 10. Regular Expressions
  76. Regular Expressions and the re Module
  77. Optional Flags
  78. Match Versus Search
  79. Anchoring at String Start and End
  80. Regular Expression Objects
  81. Match Objects
  82. Functions of the re Module
  83. REs and the := Operator
  84. The Third-Party regex Module
  85. 11. File and Text Operations
  86. The io Module
  87. The tempfile Module
  88. Auxiliary Modules for File I/O
  89. In-Memory Files: io.StringIO and io.BytesIO
  90. Archived and Compressed Files
  91. The os Module
  92. The errno Module
  93. The pathlib Module
  94. The stat Module
  95. The filecmp Module
  96. The fnmatch Module
  97. The glob Module
  98. The shutil Module
  99. Text Input and Output
  100. Richer-Text I/O
  101. Internationalization
  102. 12. Persistence and Databases
  103. Serialization
  104. DBM Modules
  105. The Python Database API (DBAPI)
  106. 13. Time Operations
  107. The time Module
  108. The datetime Module
  109. The zoneinfo Module
  110. The dateutil Module
  111. The sched Module
  112. The calendar Module
  113. 14. Customizing Execution
  114. Per-Site Customization
  115. Termination Functions
  116. Dynamic Execution and exec
  117. Internal Types
  118. Garbage Collection
  119. 15. Concurrency: Threads and Processes
  120. Threads in Python
  121. The threading Module
  122. The queue Module
  123. The multiprocessing Module
  124. The concurrent.futures Module
  125. Threaded Program Architecture
  126. Process Environment
  127. Running Other Programs
  128. The mmap Module
  129. 16. Numeric Processing
  130. Floating-Point Values
  131. The math and cmath Modules
  132. The statistics Module
  133. The operator Module
  134. Random and Pseudorandom Numbers
  135. The fractions Module
  136. The decimal Module
  137. Array Processing
  138. 17. Testing, Debugging, and Optimizing
  139. Testing
  140. Debugging
  141. The warnings Module
  142. Optimization
  143. 18. Networking Basics
  144. The Berkeley Socket Interface
  145. Transport Layer Security
  146. SSLContext
  147. 19. Client-Side Network Protocol Modules
  148. Email Protocols
  149. HTTP and URL Clients
  150. Other Network Protocols
  151. 20. Serving HTTP
  152. http.server
  153. WSGI
  154. Python Web Frameworks
  155. 21. Email, MIME, and Other Network Encodings
  156. MIME and Email Format Handling
  157. Encoding Binary Data as ASCII Text
  158. 22. Structured Text: HTML
  159. The html.entities Module
  160. The BeautifulSoup Third-Party Package
  161. Generating HTML
  162. 23. Structured Text: XML
  163. ElementTree
  164. Parsing XML with ElementTree.parse
  165. Building an ElementTree from Scratch
  166. Parsing XML Iteratively
  167. 24. Packaging Programs and Extensions
  168. What We Don’t Cover in This Chapter
  169. A Brief History of Python Packaging
  170. Online Material
  171. 25. Extending and Embedding Classic Python
  172. Online Material
  173. 26. v3.7 to v3.n Migration
  174. Significant Changes in Python Through 3.11
  175. Planning a Python Version Upgrade
  176. Summary
  177. Appendix. New Features and Changes in Python 3.7 Through 3.11
  178. Index
原版书书名:Python in a Nutshell, 4th Edition
原版书出版商:O'Reilly Media
Alex Martelli
Alex Martelli is a member of the Python Software Foundation and works as Uber Tech Lead for Google, Inc. in Mountain View, California.Before joining Google, Alex spent eight years with IBM Research,winning three Outstanding Technical Achievement Awards.He won 13 as Senior Software Consultant at think3 inc, where he developed libraries, network protocols, GUI engines, event frameworks, and web access frontends. He won three more as a freelance consultant, working mostly for AB Strakt,a Python-centered software house in Goteborg, Sweden. Alex has also taught programming languages, development methods, and numerical computing at Ferrara University and other venues. Alex's proudest achievement is the articles that appeared in Bridge World(January/February 2000), which were hailed as giant steps toward solving
issues that had haunted contract-bridge theoreticians for decades.
Anna Martelli Ravenscroft
Anna Martelli Ravenscroft is a PSF Fellow and winner of the 2013 Frank Willison Memorial Award for contributions to the Python community. She coauthored the second edition of the Python Cookbook and third edition of Python in a Nutshell. She has been a technical reviewer for many Python books and is a regular speaker and track chair at technical conferences. Anna lives in Silicon Valley with her husband Alex, two dogs, one cat, and several chickens.
Steve Holden
Passionate about programming and community, Steve Holden has worked with computers since 1967 and started using Python at version 1.4 in 1995. He has since written about Python, created instructor-led training, delivered it to an international audience, and built 40 hours of video training for “reluctant Python users.” An Emeritus Fellow of the Python Software Foundation, Steve served as a director of the Foundation for eight years and as its chairman for three; he created PyCon, the Python community’s international conference series, and was presented with the 2007 Frank Willison Memorial Award for services to the Python community. He lives in Hastings, England, and works as Technical Architect for the UK Department for International Trade, where he is responsible for the systems that maintain and regulate the trading environment.
Paul McGuire
Paul McGuire has been programming for 40+ years, in languages ranging from FORTRAN to Pascal, PL/I, COBOL, Smalltalk, Java, C/C++/C#, and Tcl, settling on Python as his language of choice in 2001. He is a PSF Fellow, and is the author and maintainer of the popular pyparsing module, as well as littletable and plusminus. Paul authored the O’Reilly book Getting Started with Pyparsing, and has written and edited articles for Python Magazine. He has also spoken at PyCon, PyTexas, and at the Austin Python User’s Group, and is active on StackOverflow. Paul now lives in Austin, Texas, with his wife and dog, and works for Indeed as a Site Reliability Engineer, helping people get jobs!
The animal on the cover of Python in a Nutshell, fourth edition, is an African rock python (Python sebae), one of the six largest snake species in the world. They are native to sub-Saharan Africa, but can also be found in other parts of the world. They can live in a wide range of habitats from temperate forests and grasslands to tropical savanna and forests. While they live mainly on the ground, they are also excellent swimmers and climbers and like to live near areas with a permanent water source. Additionally, they can be found near human settlements due to the presence of rats, mice, and other vermin.
The average size of this species of python is between ten and thirteen feet. They have large, stout bodies covered in colored blotches and irregular stripes, varying in color between brown, olive, chestnut, and yellow, fading to white on their underside. African rock pythons have triangular heads with a brown spearhead shape on top, outlined in yellow.
Pythons are nonvenomous constrictor snakes that kill their prey by suffocation. While the snake’s sharp teeth grip and hold the prey in place, the python’s long body coils around its victim’s chest, constricting tighter each time it exhales. African rock pythons feed on a wide range of mammals and birds, such as rodents, lizards, vultures, fowl, dogs, and goats. Python attacks on humans are extremely rare and only occur when provoked.