F O R E W O R D I met Al Sweigart on a chilly April day in Montreal, Canada. It was PyCon 2015 and I got
together for lunch with a few new conference friends—including Al. I immediately clicked with him
because he’s a teacher, he enjoys playing with ideas, he’s concerned about the world, and he has an
absurd (read: wonderful) sense of humor. When I met Al, I didn't know he was famous, and neither
did he. It was during another meal when a reader of Automate the Boring Stuff with Python who had been
sitting with us discovered that the Al at our table was the Al Sweigart.
New conference friend: ―Wait, you’re Al Sweigart? Your book is amazing!‖
Me: ―Al, you didn’t tell me you were famous.‖
Al: ―I didn’t know I was famous either!‖
If this book is your first introduction to Al, you should know that he’s a pragmatic Python
programmer who is marvelous at embracing Python’s power to churn out code that solves real world
problems. I don't always agree with Al’s code style choices (camelCase in Python, Al?!) but Al
comments his code clearly and breaks down problems succinctly, and I know many Python
programmers who were introduced to the beauty of Python through Al’s work.
So now you know that I'm in the Al Sweigart fan club. But who am I, and why am I writing the
foreword for this book?
My name is Trey Hunner. I’m a Python team trainer and I run Python Morsels, which helps
Python developers grow their skills through Python exercises and detailed solution walk-throughs. I
started a Python exercise service because I know that the most important part of my team training
sessions is exercise time.
In fact, there’s a mantra I repeat to my students before every Python exercise session: We don’t
learn by putting information into our heads; we learn by trying to retrieve information from our
heads.
Learning happens when we attempt to use our memory. Whether we're remembering rote facts,
practicing muscle memory, or attempting to identify which tool in our mental toolbox applies to the
situation at hand. You can watch YouTube videos on Python all you want, but you’ll quickly forget
each new Python feature you see unless you actually use those features in your own code.
If you want to learn Python, you need to write Python code. That’s where Python exercises (and
this book) come in. You can't grow your Python skills by writing yet another ―hello world‖ program.
You need to write code that pushes you just outside your learning comfort zone (―the zone of
proximal development‖, as learning nerds call it).
I hope you'll find a few exercises that push you out of your comfort zone in this short book—
written by the Al Sweigart.
Trey Hunner, https://treyhunner.com/