Python Playground: Geeky Projects for the Curious Programmer cover

Python Playground: Geeky Projects for the Curious Programmer

Rating 4.1
Word count
441K words
Chapters
22
ISBN
9787115449764

Tags

Summary

Python Playground is a project-driven advanced Python book written by software engineer Mahesh Venkitachalam based on the hands-on projects on his programming blog electronut.in. The book does not teach Python syntax basics; instead, it assumes readers already know basic syntax and programming concepts, and through 14 hands-on projects that progress from easy to difficult and span multiple domains, it leads readers to experience Python's uses in graphics, music, simulation, and hardware interaction. The book is divided into five parts. Part One is warm-up projects: a music library analysis script that parses an iTunes playlist, and spirograph patterns drawn with parametric equations and the turtle module. Part Two simulates life: Conway's Game of Life with NumPy and Matplotlib, synthesis of plucked-string instrument overtones with the Karplus-Strong algorithm, and simulation of flocking behavior with the Boids algorithm. Part Three is image processing: converting images to ASCII art, assembling many small images into a photo mosaic, and creating autostereograms from depth maps. Part Four enters the three-dimensional world: the basics of 3D graphics with OpenGL and shaders, particle systems and fireworks fountains, and volume rendering based on CT or MRI data. Part Five turns to hardware: an introduction to Arduino, a music-responsive laser show, and a Raspberry Pi-based weather monitor. The appendixes also offer advice on software installation, basic electronics, and using the Raspberry Pi. Each project follows the structure of "explanation of principles—required modules—code walkthrough—complete code—running results—summary—experiments," so that readers, while reproducing the projects by hand, both practice common libraries (numpy, matplotlib, pygame, Pillow, PyOpenGL) and develop the ability to break complex problems into algorithms and implement them step by step.

Editor's review

很多 Python 学习者卡在「语法都会、就是不知道能干什么」的阶段。这本书正是为这个阶段准备的:它不重复讲列表推导式和装饰器,而是直接端上十几个有画面、有声音、能跑起来的项目——万花尺在屏幕上旋转生长,鸟群在窗口里聚散,照片被拼成另一张照片,激光随音乐跳动。 这本书的难得之处在于「跨学科但不失严谨」。作者在每个项目开头都会把背后的数学模型、物理原理或算法思想讲清楚,再用代码一点点落地,而不是丢给你一段能跑的脚本。读者看到的是从问题到算法的完整思路,这正是从「会写脚本」走向「会做项目」的关键一步。 书中案例覆盖 NumPy、Matplotlib、pygame、Pillow、PyOpenGL 等常用库,最后一部分还延伸到 Arduino 与树莓派,让纯软件读者第一次接触硬件编程。项目之间难度递进,读者可按顺序推进,也可挑感兴趣的章节单独试做。适合放在案头当「周末动手清单」,一项目一项目地啃。

Who it's for

A good fit for

  • 已掌握 Python 基本语法、想做点真实项目练手的初学者
  • 对图形、声音、仿真等跨领域编程感兴趣的技术爱好者
  • 需要教学案例或课程项目素材的教师与培训讲师
  • 想入门 OpenGL、树莓派、Arduino 的软件开发者

Not a good fit for

  • 完全零基础、尚未接触过 Python 语法的读者
  • 只想系统学习 Python 语言机制与理论体系的读者
  • 期待直接拿到生产级框架代码的工程人员

Reading tips

  1. 先读完前言和附录A,把 Python 环境与依赖库装好,再开始第一个项目。
  2. 按章节亲手敲代码而非直接运行源码,遇到报错时对照「小结」「实验」部分排查。
  3. 数学推导部分不必一次吃透,可先跑通效果再回头理解公式与算法。
  4. 硬件章节成本较高,可先用作者提供的模拟数据或替代方案验证逻辑。

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. Part One: Warming Up
  2. Chapter 1: Parsing an iTunes Playlist
  3. Chapter 2: Spirographs
  4. Part Two: Simulating Life
  5. Chapter 3: Conway's Game of Life
  6. Chapter 4: Musical Overtones with the Karplus-Strong Algorithm
  7. Chapter 5: Boids: Simulating a Flock of Birds
  8. Part Three: Fun with Images
  9. Chapter 6: ASCII Art
  10. Chapter 7: Photo Mosaics
  11. Chapter 8: Autostereograms
  12. Part Four: Entering the Third Dimension
  13. Chapter 9: Understanding OpenGL
  14. Chapter 10: Particle Systems
  15. Chapter 11: Volume Rendering
  16. Part Five: Hardware Play
  17. Chapter 12: Introduction to Arduino
  18. Chapter 13: Laser Music Show
  19. Chapter 14: A Raspberry Pi-Based Weather Monitor
  20. Appendix A: Software Installation
  21. Appendix B: Basic Practical Electronics
  22. Appendix C: Raspberry Pi Tips and Tricks

FAQ

这本书适合零基础学 Python 吗?
不太适合。作者在书中明确说明本书不介绍 Python 基础知识,默认读者了解基本语法和编程概念,并能看懂高中数学。完全没有编程经验建议先学一本入门教材,再回来做项目。
书中的代码还能跑起来吗?
本书基于 Python 2/3 交替时期的库版本写成,直接运行可能遇到库接口变化或依赖安装问题。建议使用虚拟环境安装指定版本库,遇到问题时参照社区勘误,或考虑 2024 年出版的第 2 版(已按 Python 3.9 全面更新)。
做硬件项目必须买 Arduino 和树莓派吗?
第五部分的三个项目需要对应硬件。若只想学软件部分,前 11 章完全可在普通电脑上完成;也可以先阅读硬件章节的原理讲解,等有条件时再动手。
这本书和《Python极客项目编程(第2版)》有什么区别?
第 2 版由袁国忠翻译、2024 年出版,共 15 个项目,新增科赫雪花、群体行为、物联网花园、树莓派音频机器学习等内容,并基于 Python 3.9 重写代码,还去掉了 Arduino 部分。两版项目不完全重合,可按手中的 Python 版本选择。

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.

More by the same author

Top rated in the same category