学习Python(第二版,影印版)
学习Python(第二版,影印版)
Mark Lutz, David Ascher
出版时间:2005年06月
页数:624
Python是流行、开源、面向对象的编程语言,既可以用于编写单机运行的程序也可以编写脚本程序,具有可移植、强大、易用等特点。跟随专业教师学习是最快捷的掌握此语言的方式。新版的《学习Python》把你带到Mark Lutz和David Ascher面前,他们是著名的Python专家和培训师,他们的用语亲切、组织良好的文章已经指导了许多编程者精通这种语言。
《学习Python(第二版)》给程序员提供了一个学习Python和面向对象编程的综合学习工具。它根据1999年该书第一版发布以来Python语言的大量变化做了更新。本书介绍了最近发布的Python 2.3的基本要素并涵盖了新的特性,如列表内涵,嵌套作用域和迭代器/产生器。
除了语言特性,《学习Python(第二版)》还为初级程序员提供了新的内容,包括新的面向对象编程和动态类型回顾,新的关于编程起步和配置选项的讨论,新的关于文档的内容等等。全书用新的实例使得语言特性的应用更加具体。
《学习Python(第二版)》首先给出了理解和构造Python程序必需的所有信息,包括类型、运算符、表达式、类、函数、模块和异常。然后,作者给出了更高级的内容,通过真实的应用和可用扩展库说明如何用Python完成一般的任务。全书提供了练习以检验自己的新技能。
《学习Python(第二版)》是本可灵活选读的图书,它让读者能够集中深入Python语言的核心。随着通读全书,你将获得对Python深入而完整的理解,这将帮助你自己开发大型的应用程序。本书适合于任何不仅仅想停留于了解Python而且想更好地掌握它的人。
对本书第一版的褒奖:
“这本书最优之处是作者在提供有用的实例与详细解释说明之间取得近乎完美的平衡。无论你是有经验的计算机程序员还是初学者,这本书对于学习Python语言都是非常适合的。”
——Andrew Morrison, CedarLug
  1. Preface
  2. Part I. Getting Started
  3. 1. A Python Q&A Session
  4. Why Do People Use Python?
  5. Is Python a Scripting Language?
  6. Okay,But What's the Donside?
  7. Who Uses Python Today?
  8. What Can I Do with Python?
  9. What Are Python's Technical Strengths?
  10. How Does Python Stack Up to Language X?
  11. 2. How Python Runs Programs
  12. Introducing the Python Interpreter
  13. Program Execution
  14. Execution Model Variations
  15. 3. How You Run Programs
  16. Interactive Coding
  17. System Command Lines and Files
  18. Clicking Windows File Icons
  19. Module Imports and Reloads
  20. The IDLE User Interface
  21. Other IDEs
  22. Embedding Calls
  23. Frozen Binary Executables
  24. Text Editor Launch Options
  25. Other Launch Options
  26. Future Possibilities?
  27. Which Option Should I Use?
  28. Part I Exercises
  29. Part II. Types and Operations
  30. 4. Numbers
  31. Python Program Structure
  32. Why Use Built-in Types?
  33. Numbers
  34. Python Expression Operators
  35. Numbers in Action
  36. The Dynamic Typing Interlude
  37. 5. Strings
  38. String Literals
  39. Strings in Action
  40. String Formatting
  41. String Methods
  42. General Type Categories
  43. 6. Lists and Dictionaries
  44. Lists
  45. Lists in Action
  46. Dictionaries
  47. Dictionaries in Action
  48. 7. Tuples, Files, and Everything Else
  49. Tuples
  50. Files
  51. Type Categories Revisited
  52. Object Generality
  53. References Versus Copies
  54. Comparisons,Equality,and Truth
  55. Python's Type Hierarchies
  56. Other Types in Python
  57. Built-in Type Gotchas
  58. Part II Exercises
  59. Part III. Statements and Syntax
  60. 8. Assignment, Expressions, and Print
  61. Assignment Statements
  62. Expression Statements
  63. Print Statements
  64. 9. if Tests
  65. if Statements
  66. Python Syntax Rules
  67. Truth Tests
  68. 10. while and for Loops
  69. while Loops
  70. break,continue,pass,and the Loop else
  71. for Loops
  72. Loop Variations
  73. 11. Documenting Python Code
  74. The Python Documentation Interlude
  75. Common Coding Gotchas
  76. Part III Exercises
  77. Part IV. Functions
  78. 12. Function Basics
  79. Why Use Functions?
  80. Coding Functions
  81. A First Example:Definitions and Calls
  82. A Second Example:Intersecting Sequences
  83. 13. Scopes and Arguments
  84. Scope Rules
  85. The global Statement
  86. Scopes and Nested Functions
  87. Passing Arguments
  88. Special Argument Matching Modes
  89. 14. Advanced Function Topics
  90. Anonymous Functions:lambda
  91. Applying Functions to Arguments
  92. Mapping Functions Over Sequences
  93. Functional Programming Tools
  94. List Comprehensions
  95. Generators and Iterators
  96. Function Design Concepts
  97. Function Gotchas
  98. Part IV Exercises
  99. Part V. Modules
  100. 15. Modules: The Big Picture
  101. Why Use Modules?
  102. Python Program Architecture
  103. How Imports Work
  104. 16. Module Coding Basics
  105. Module Creation
  106. Module Usage
  107. Module Namespaces
  108. Reloading Modules
  109. 17. Module Packages
  110. Package Import Basics
  111. Package Import Example
  112. Why Use Package Imports?
  113. A Tale of Three Systems
  114. 18. Advanced Module Topics
  115. Data Hiding in Modules
  116. Enabling Future Language Features
  117. Mixed Usage Modes:_ _name_ _and _ _main_ _
  118. Changing the Module Search Path
  119. The import as Extension
  120. Module Design Concepts
  121. Module Gotchas
  122. Part V Exercises
  123. Part VI. Classes and OOP
  124. 19. OOP: The Big Picture
  125. Why Use Classes?
  126. OOP from 30,000 Feet
  127. 20. Class Coding Basics
  128. Classes Generate Multiple Instance Objects
  129. Classes Are Customized by Inheritance
  130. Classes Can Intercept Python Operators
  131. 21. Class Coding Details
  132. The Class Statement
  133. Methods
  134. Inheritance
  135. Operator Overloading
  136. Namespaces:The Whole Story
  137. 22. Designing with Classes
  138. Python and OOP
  139. Classes as Records
  140. OOP and Inheritance: " is-a" Relationships
  141. OOP and Composition: "has-a" Relationships
  142. OOP and Delegation
  143. Multiple Inheritance
  144. Classes Are Objects:Generic Object Factories
  145. Methods Are Objects:Bound or Unbound
  146. Documentation Strings Revisited
  147. Classes Versus Modules
  148. 23. Advanced Class Topics
  149. Extending Built-in Types
  150. Pseudo-Private Class Attributes
  151. "New Style" Classes in Python 2.2
  152. Class Gotchas
  153. Part VI Exercises
  154. Part VII. Exceptions and Tools
  155. 24. Exception Basics
  156. Why Use Exceptions?
  157. Exception Handling:The Short Story
  158. The try/except/else Statement
  159. The try/finally Statement
  160. The raise Statement
  161. The assert Statement
  162. 25. Exception Objects
  163. String-Based Exceptions
  164. Class-Based Exceptions
  165. General raise Statement Forms
  166. 26. Designing with Exceptions
  167. Nesting Exception Handlers
  168. Exception Idioms
  169. Exception Design Tips
  170. Exception Gotchas
  171. Core Language Summary
  172. Part VII Exercises
  173. Part VIII. The Outer Layers
  174. 27. Common Tasks in Python
  175. Conversions,Numbers,and Comparisons
  176. Manipulating Strings
  177. Data Structure Manipulations
  178. Manipulating Files and Directories
  179. Internet-Related Modules
  180. Executing Programs
  181. Debugging,Testing,Timing,Profiling
  182. Exercises
  183. 28. Frameworks
  184. An Automated Complaint System
  185. Interfacing with COM:Cheap Public Relations
  186. A Tkinter-Based GUI Editor for Managing Form Data
  187. Jython:The Felicitous Union of Python and Java
  188. Exercises
  189. 29. Python Resources
  190. Layers of Community
  191. The Process
  192. Services and Products
  193. The Legal Framework:The Python Software Foundation
  194. Software
  195. Popular Third-Party Software
  196. Web Application Frameworks
  197. Tools for Python Developers
  198. Part IX. Appendixes
  199. A. Installation and Configuration
  200. B. Solutions to Exercises
  201. Index
书名:学习Python(第二版,影印版)
作者:
译者:Mark Lutz, David Ascher
国内出版社:东南大学出版社
出版时间:2005年06月
页数:624
书号:7-5641-0047-8
原版书出版商:O'Reilly Media
The animal on the cover of Learning Python, Second Edition is a wood rat (Neotoma, family Muridae). The wood rat lives in a wide range of living conditions (mostly rocky, scrub, and desert areas) over much of North and Central America, generally at some distance from humans, though they occasionally damage some crops. They are good climbers, nesting in trees or bushes up to six meters off the ground; some species burrow underground or in rock crevices or inhabit other species' bandoned holes.
These grayish-beige, medium-sized rodents are the original pack rats: they carry anythingand everything into their homes, whether or not it's needed, and are espe-cially attracted to shiny objects such as tin cans, glass, and silverware.