《Learn Python Programming(4th)》读后感

一、 为什么读这本书?

之所以选择读这本书是因为“例行惯例”——读每年新出版的Python相关书籍,尝试从这些书中收集一些好的示例,帮助理解一些不好理解的概念。

当然,其实《Learn Python Programming(4th)》(中译名:《Python编程入门与实战》,Packt Publishing 出版社)是 2024年 9 月 24 日出版的,只是 2024 年没有读,推到了 2025 年读。

二、这本书写了什么?

本书总共分为17章,按找内容可以划分为两部分:第一部分为Python 基础;第二部分为 Python应用。

第一部分 Python 应用涵盖:

(1) 概览(安装、虚拟环境、模块、包、运行)。

(2) 数据结构(int, str, tuple, list, set, dict)。

(3) 控制流程(if 语句,match 语句,for 语句,while 语句)。

(4) 函数(定义,参数,匿名函数,内置函数)。

(5) 面向对象编程(OOP,类,继承)

(6) 文件和输入输出

(7) 异常&调试&测试&日志&性能分析。

(8) 其它(类型提示,加密)

第二部分为 Python 应用涵盖:

(1) 数据科学(Pandas, Numpy)。

(2) API开发(FastAPI)

(3) CLI应用。

(4) Python应用打包。

(5) 编程挑战。

总体而言大部分内容都涵盖了,唯独第一部分缺乏“并发编程”,实在不应该,因为一个稍微大型一点的应用必然离不开并发编程,可以说是项目必备。

当然,还有一个最“滑稽”的,作者在第 12 章大谈类型提示的好处——“1.Improved code readability and documentation;2.Enhanced error detection;3.Better IDE experience and autocompletion;4.Improved collaboration and code reviews;5.Code flexibility and reusability。”。但是,除了第十二章为了演示类型提示的代码用了类型提示,其它的代码都没用类型提示。我只想问一句“两位这作者,你们这样违心,哈特(heart)不会痛吗?”

从 2025 年 8 月 27 日至 2025 年 11 月 5 日,期间断断续续花了 47 天阅读完《Learn Python Programming(4th)》。

三、这本书特点

1.简单但啰嗦

这算是 Packt Publishing 出版社的一个“feature”,截止目前我读过的所有 Packt Publishing 出版的书都有这个问题,导致虽然书中内容很浅,但已经600多页了。

其它都是些小问题,不赘述。本来想说一下优点,可是翻遍整个读书笔记,发现没有记录优点,I'm sorry~

四、这本书适合什么样的人?

回到“为什么阅读这本书”——读每年新出版的Python相关书籍,尝试从这些书中收集一些好的示例,帮助理解一些不好理解的概念。这次发现一个不错的例子,以前我总是记不住“什么是强类型语言/弱类型语言?(虽然这两个概念也没啥用)”

<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="" cid="n30" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: pre; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"># Python: 强类型语言
a = 2
b = "2"
print(a + b) # TypeError: unsupported operand type(s) for +: 'int' and 'str'

// PHP: 弱类型语言
<?php
a = 2;b = "2";
echo a +b; // 4
?></pre>

本书属于入门级教材,适合想入门 Python 的人员,如果已经有 Python 基础了,那么这本书可以不看。因为没有涉及多少高级主题,同时书中的例子缺乏工程性,虽然说写法没有错,但一般在实际开发中不这么用。

假设你确实想通过这本书入门 Python,那么提供一个阅读建议:如果你能看懂作者写的代码,就可以跳过作者的解释,很多解释没有太大意义,不用担心错过重要的内容。

五、推荐指数

按照 5 星的标准,本书推荐指数 2 颗星。

六、参考资料

1. 编程

(1)豆瓣,Fabrizio Romano,Heinrich Kruger:https://book.douban.com/subject/37497224/

(2)源码,Github: https://github.com/PacktPublishing/Learn-Python-Programming-Fourth-Edition

2. 英语

(1) Etymology Dictionary:https://www.etymonline.com

(2) Cambridge Dictionary:https://dictionary.cambridge.org

欢迎搜索及关注:编程人(a_codists)

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容