Python for Programmers cover

Python for Programmers

No rating yet
Word count
580 words
Chapters
40
ISBN
9787115482624

Tags

Summary

This book is a Python book for readers who have studied programming and already have some programming experience. The author, Qiu Zongyan, is a professor at the School of Mathematical Sciences, Peking University. The book does not explain programming from scratch; instead, it seeks to build on the reader's existing programming experience to explain the characteristics of the Python language and the in-depth concepts needed to use it accurately and correctly. The book has five chapters. Chapter 1 starts from expressions and computation, variables and assignment, conditionals and loops, and function definition, sorting out Python's basic syntax and programming techniques and discussing recursion, lambda expressions, scope, default parameters, and keyword arguments. Chapter 2 introduces data construction and organization tools such as lists, tuples, sequences and comprehensions, string formatting, files, dictionaries, and sets, as well as text processing and data persistence. Chapter 3 goes deeper into semantics, discussing variables and objects, environments and state, generator functions and closures, exception handling mechanisms, and program efficiency. Chapter 4 covers data abstraction, classes and objects, inheritance and multiple inheritance, special methods and container classes, iterators, and context management, with linked lists as a practical example. Chapter 5 moves to advanced topics, including program and module organization, the import system, dynamic compilation and execution, function decorators and class decorators, metaclasses and descriptors, and other advanced object-oriented mechanisms, as well as coroutines, asynchronous iteration, and async with. The book ends with a concise Python language handbook, a standard function table, an introduction to the IDLE development environment, and the standard library packages used in the book for easy reference.

Editor's review

市面上的Python书大多面向零基础读者,讲完语法就转到库和框架,语言的底层机制往往一带而过。这本书走的是另一条路:默认读者已经会编程,甚至会用另一门语言写程序,于是把篇幅放在“为什么这样写才对”上——变量和对象的关系、函数参数传递的语义、闭包的环境、异常作为控制机制、描述器如何驱动属性访问,这些平时容易含糊过去的地方都被逐一拆开讲清楚。作者裘宗燕长期在北大讲授程序设计语言课程,叙述带有教材式的严谨:概念先给定义,再给例子,最后做归纳,每章末尾的“总结和补遗”又把易错点集中梳理一遍。第5章对模块导入系统、装饰器、元类和协程异步编程的讨论,是很多入门书跳过、而在实际工程中又绕不开的内容。书中所有示例都可直接运行,附录还配有语言速查表和IDLE使用说明,方便当工具书翻查。若你已经能写Python,却常常对它的运行机制说不清,这本书值得放在手边反复读。

Who it's for

A good fit for

  • 已掌握一门编程语言、想系统补齐Python知识的开发者
  • 把Python作为第二门语言学习的高校计算机相关专业学生
  • 在教学中需要一本偏语言机制讲解的Python教材的教师
  • 写过一些Python脚本、但对闭包、装饰器、协程等概念仍感模糊的程序员

Not a good fit for

  • 完全没有编程经验、需要从零入门的读者
  • 只想尽快上手某个框架或做数据分析应用的读者
  • 期待大量项目实战案例和工程模板的读者

Reading tips

  1. 第1、2章可快速浏览,重点核对与已知语言不同的语法细节,如循环的else段、描述式、字典与函数参数的关系。
  2. 第3、4章建议边读边在解释器中验证书中的语义例子,尤其是变量与对象、闭包环境、特殊方法调用这几处。
  3. 第5章的模块导入、装饰器、描述器和协程可按需选读,读完后尝试改写自己项目中的对应代码加深理解。
  4. 把附录A的语言速查表和附录B的标准函数表当作日常参考,遇到语法疑问先查表再回到正文。

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Chapter 1 Python Basics
  2. 1.1 Expressions and Calculations
  3. 1.2 Variables and Assignment
  4. 1.3 Logic and Control
  5. 1.4 Defining Functions
  6. 1.5 Several Issues in Function Definition
  7. 1.6 Summary and Addenda
  8. Chapter 2 Constructing and Organizing Data
  9. 2.1 Lists and Tuples
  10. 2.2 Sequences and Sequence Operations
  11. 2.3 Strings and Formatting
  12. 2.4 Files
  13. 2.5 Dictionaries (dict)
  14. 2.6 Sets (set and frozenset)
  15. 2.7 Programs and Data
  16. 2.8 Summary and Addenda
  17. Chapter 3 Understanding Python in Depth
  18. 3.1 Fundamental Semantic Issues
  19. 3.2 Semantic Implementation of Programs
  20. 3.3 Generator Functions and Closures
  21. 3.4 Exceptions and Exception Handling
  22. 3.5 Efficiency
  23. 3.6 Summary and Addenda
  24. Chapter 4 Object-Oriented Programming
  25. 4.1 Data Abstraction, Classes, and Custom Types
  26. 4.2 Classes and Objects in Python
  27. 4.3 Inheritance
  28. 4.4 Special Method Names and Special Classes
  29. 4.5 Example: Linked Lists
  30. 4.6 Summary and Addenda
  31. Chapter 5 Advanced Python Programming
  32. 5.1 Programs and Modules
  33. 5.2 Decorators
  34. 5.3 Advanced Object-Oriented Programming
  35. 5.4 Asynchronous Programs and Coroutines
  36. 5.5 Summary and Addenda
  37. Appendix A A Concise Handbook of the Python Language
  38. Appendix B Standard Functions
  39. Appendix C The IDLE Development Environment
  40. Appendix D Standard Library Packages Used in This Book

FAQ

这本书适合零基础自学Python吗?
不太适合。作者在序言中明确说明,本书面向学过编程、有一定编程经验的读者,也可作为以Python为第二门语言的高校课程教材。零基础读者宜先读同作者的《从问题到程序:用Python学编程和计算》,再来读这本。
书中内容基于Python的哪个版本?
本书2018年由人民邮电出版社出版,正文涉及协程、async with、异步迭代等较新的语言特性,示例基于Python 3编写,但具体小版本未在书目信息中注明,实际练习时建议使用较新的Python 3环境并留意语法变化。
这本书和《从问题到程序:用Python学编程和计算》有什么区别?
两书作者相同但定位不同。《从问题到程序》面向编程初学者,从计算与程序的基本概念讲起;《程序员学Python》假设读者已有编程基础,重点讨论Python的深入语义、面向对象机制和模块化、装饰器、协程等进阶功能。选书时按自己的起点决定即可。
书中的例子需要额外安装第三方库吗?
从目录与附录看,全书示例主要使用Python标准库,附录D专门列出书中用到的标准库包,未强调依赖第三方框架。因此按书练习时,安装官方Python并配合IDLE即可,无需复杂环境配置。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

Top rated in the same category