Beginning Python: Using Python 2.6 and Python 3.1 cover

Beginning Python: Using Python 2.6 and Python 3.1

Rating 3.4
Word count
846K words
Chapters
25
Series
A classic Wrox red book that teaches syntax from zero and then throws readers straight into real technology stacks. Its greatest strength is breadth: most Python primers stop at files and exceptions, but this one goes on to unit testing, Tkinter GUIs, DBM and relational databases, XML parsing, sockets, C extensions, numerical programming, Django, web services, and Jython. Its second strength is the dual-version approach: the book targets both Python 2.6 and 3.1 and deliberately chooses syntax that runs in both, making the 2-to-3 transition tangible. Note the age: the book dates from around 2010 and the Chinese edition from 2011, so some library usage, Django patterns, and Python 2 chapters are outdated, and Jython is rarely used today. Treat it as an overview of the language's evolution rather than a code-along manual. Each chapter has a summary and exercises, making it suitable as a course reference.
ISBN
9787302257097

Tags

Summary

Beginning Python: Using Python 2.6 and Python 3.1 is the simplified Chinese translation of the Wrox book Beginning Python: Using Python 2.6 and Python 3.1, translated by Zhang Chunhui and published by Tsinghua University Press in 2011 (1st edition, 533 pages, about 846,000 characters). Author James Payne is editor-in-chief of the Developer Shed network of websites and has long used Python to develop software for the financial industry. The book has four parts. Part I, "Getting Started with Python," begins with strings, numbers and operators, and variables, then covers the Python Shell and built-in types such as tuples, lists, and dictionaries. Part II, "Python Language and the Standard Library," explains conditionals, loops, functions, classes and objects, organizing modules and packages, file and directory operations, and often-overlooked language features such as lambda, map, list comprehensions, and regular expressions. Part III, "Putting Python to Work," applies the language to concrete domains: unit testing and test suites, GUI programming with Tkinter, data access with DBM and relational databases, XML parsing with SAX/DOM/lxml, sockets and network protocols, extending Python with C, numerical programming, an introduction to Django, web applications and web services, and integrating Jython with Java. Part IV consists of appendices with general reference material. A distinctive feature of the book is that it teaches Python 2.6 and Python 3.1 side by side and, wherever possible, uses syntax that runs in both versions, helping readers understand the migration differences from Python 2 to Python 3. Each chapter includes a summary and exercises. Note that the book's content is based on versions 2.x/3.1; some idioms and modules (such as Python 2's print statement habits and Jython integration) now differ from Python 3.10 and later, so readers should check the official documentation for comparison.

Editor's review

这是一本典型的 Wrox“红皮书”:开头从零讲语法,后半程直接把读者扔进真实技术栈。 它最值得称道的地方是覆盖面。大多数 Python 入门书在第 8 章(文件和异常)就收尾,而这本书在讲完类、模块、文本处理之后,还会带你写单元测试、用 Tkinter 搭界面、连 DBM 与关系数据库、解析 XML、写套接字服务器、用 C 扩展解释器、做数值计算、跑起一个 Django 站点,最后还讲 Jython 与 Java 的互操作。对想看清“Python 到底能做什么”的初学者,这种广度很有价值。 第二个特点是“双版本对照”。全书同时面向 Python 2.6 和 3.1,作者刻意选择在两个版本中都能运行的写法,读者会自然体会到 print、字符串、整除等差异,这对理解 Python 2 到 3 的过渡很直观。 需要提醒的是版本年代:本书成书于 2010 年前后,中文版 2011 年出版。书中部分库用法、Django 写法以及 Python 2 相关章节已经过时,Jython 的部分在今天也少有人用。把它当作“建立全景认识、了解语言演进”的入门读本,而不是照抄代码的手册,会更合适。每章带小结与习题,也适合作为课程参考书。

Who it's for

A good fit for

  • 完全没有编程经验、想系统了解 Python 全貌的初学者
  • 需要从 Python 2.x 迁移到 Python 3、想理解两版差异的开发者
  • 高校 Python 课程的学生,可配合每章小结与习题练习
  • 想快速浏览 Python 在 GUI、数据库、XML、网络、Web 等领域落点的人

Not a good fit for

  • 已经熟练使用 Python 3、希望学习现代工程实践的进阶开发者
  • 需要学习数据分析、机器学习等当代主流方向的读者
  • 希望照着书中代码直接运行、不愿查对新版本文档的人

Reading tips

  1. 第Ⅰ、Ⅱ部分按顺序精读并动手敲代码,务必边读边在 Python Shell 里验证。
  2. 第Ⅲ部分可挑章节跳读:先读测试、文件、数据库和网络,GUI 与 Jython 可按兴趣取舍。
  3. 遇到与当前 Python 版本不符的写法,以官方文档为准并顺手记录差异,这本身就是很好的学习。
  4. 每章末尾习题不要跳过,它们是检验是否真正理解语法细节的最低成本方式。

About the publisher

Tsinghua University Press China · Founded in 1980

Founded in 1980, Tsinghua University Press has 57 titles in our collection, covering popular science, medicine, health, law, philosophy and social sciences. Representative works include medical popular-science books such as Cancer Truth: Doctors Are Reading It Too and New Knowledge on Cancer by Bo Luo (Li Zhizhong), legal titles such as Sunshine Is the Best Preservative: Express Delivery of Major Global Anti-Corruption Cases, and works like Qi Ge's A Brief History of Philosophy with Big Ideas and Liu Yunhao's From the Internet to a New Industrial Revolution. Its authors include science writers, medical researchers, the Renmin University of China anti-corruption master's class and university scholars, reflecting a publishing profile that balances academic seriousness with accessible reading. As public information is limited, this profile is based only on the titles in our collection.

Contents

  1. Part I Getting Started with Python
  2. Chapter 1 Programming Basics and Strings
  3. Chapter 2 Numbers and Operators
  4. Chapter 3 Variables
  5. Part II Python Language and the Standard Library
  6. Chapter 4 Making Decisions
  7. Chapter 5 Functions
  8. Chapter 6 Classes and Objects
  9. Chapter 7 Organizing Programs
  10. Chapter 8 Files and Directories
  11. Chapter 9 Other Features of the Python Language
  12. Chapter 10 Creating Modules
  13. Chapter 11 Text Processing
  14. Part III Putting Python to Work
  15. Chapter 12 Testing
  16. Chapter 13 Writing GUIs with Python
  17. Chapter 14 Accessing Databases
  18. Chapter 15 Processing XML with Python
  19. Chapter 16 Network Programming
  20. Chapter 17 Extending Python with C
  21. Chapter 18 Numerical Programming
  22. Chapter 19 Introduction to Django
  23. Chapter 20 Web Applications and Web Services
  24. Chapter 21 Integrating Java and Python
  25. Part IV Appendices

FAQ

这本书讲的是 Python 2 还是 Python 3?
两者都讲。原书名为 Using Python 2.6 and Python 3.1,作者刻意选用在两个版本中都能运行的写法,并顺带说明差异。今天的读者请以 Python 3 为主线,把 Python 2 相关内容当作历史背景。
零基础可以直接读吗?
可以。第1章从“编程与使用计算机的区别”讲起,安装、Shell、字符串都从最基础说起,不假设读者有编程经验。但后半部分涉及数据库、C 扩展、Jython 等主题,需要一点耐心。
书中代码现在还能跑吗?
大部分基础语法代码仍可运行,但 Django、数据库 API、GUI 控件以及 Python 2 相关示例可能与当前版本不符。建议在 Python 3.10 以上环境动手,并查阅最新官方文档。
这本书和《Python编程:从入门到实践》怎么选?
若只想尽快上手做项目,后者更贴近当下生态;若想通过一本书看清 Python 在测试、GUI、数据库、XML、网络、Web、Java 集成等方向的整体版图,本书的广度更有优势,但要接受其内容较旧。
书名中的“经典”是指内容权威吗?
这里的“经典”来自 Wrox 入门书系的中译命名传统,指其体例完整、覆盖面广,并非评价其为不可替代的权威著作。豆瓣评分 6.7 分,读者对翻译与年代感评价不一。

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