This week we welcome Al Sweigart as our PyDev of the Week. Al is the author of the PyAutoGUI and Pyperclip packages. He is also the author of several Python books such as:
- Automate the Boring Stuff with Python: Practical Programming for Total Beginners
- Hacking Secret Ciphers with Python
- Making Games with Python & Pygame
- Invent Your Own Computer Games with Python
He has also released a book on Scratch called Scratch Programming Playground. Al is quite well known in the Python world and his books have received really good reviews. Let’s take some time to get to know him better!
Could you tell us a little about yourself (hobbies, education, etc):
I was fortunate enough to be introduced to programming early on and then majored in computer science at UT Austin (“hook ’em!”) but I hate telling people this. A lot of folks think programming is something you have to have started in as a toddler in order to become proficient. The truth is everything I learned about programming in between the 3rd and 12th grade can be learned in a dozen free weekends.
Aside from coding, I like to write coding tutorials and record coding screencasts. I also volunteer at the San Francisco SPCA and Oakland’s video game museum, the MADE.
Why did you start using Python?
I think around senior year of college. Before then I used Perl and PHP to write quick little scripts. Python really stuck out as a great language and has been my favorite ever since. Unlike Perl, the code is readable and it has a level of documentation that is as good as PHP’s.
The Python community is top notch. Attending PyCon is one of the highlights of my year.
What other programming languages do you know and which is your favorite?
I’ve done some work in Java and JavaScript. More recently I’ve gotten into Lua. In the distant past I’ve used Perl, PHP, C++, and Visual Basic. I learned a bit of Ruby. Python still beats them all as my favorite though.
What projects are you working on now?
I’m trying to get caught up on issues and pull requests for my PyAutoGUI and Pyperclip modules. I’ve just finished a book project, Scratch Programming Playground, which came out in September 2016. My next book project is teaching kids to code by using a Minecraft mod called ComputerCraft. The CC mod lets you program robots that move around the Minecraft world, so you can have robots programmed to do your building, mining, and crafting. Unfortunately the mod uses Lua rather than Python. But given the popularity of Minecraft, I see it as a nice gateway drug into programming.
Which Python libraries are your favorite (core or 3rd party)?
I’m really impressed with how useful Selenium is. I also appreciate Requests for showing what a well-designed API should look like. I have a hard time deciding if I like Flask or Django better for web apps. OpenCV, the computer vision library, and Kivy are modules I’m looking forward to learning more about.
Why did you decide to write books about Python?
Several years ago my girlfriend at the time was a nanny for a precocious ten-year-old. He wanted to learn how to program, so he asked her to ask me for some resources. I couldn’t really find any though. A lot of stuff out there is either made for professional developers or is really watered down. I remember the way I got into programming was copying the source code for some games and just playing around with them. All of my own games were derivatives, but it was nice to have a project to work on rather than just learning a bunch of programming concepts with no application. I started writing a tutorial, which eventually ballooned into book-length. I had it available for free online under a Creative Commons license, and decided to self-publish it. People seemed to like it, so I wrote another one, then another, and it became my main hobby. In 2014 I left my software developer job to write full time.
What have you learned from writing about Python?
This is embarrassing: I learned what the difference was between an expression and a statement. For years and years, I just sort of used those terms interchangeably without thinking about it too much. It is completely true that teaching someone else shines a light on all the gaps in your own knowledge. And just like the majority of work in writing code isn’t writing it but debugging it, editing my books took far more effort than writing them. Developers in general are pretty terrible at explaining programming: we’ve forgotten what it was like to be unfamiliar with these concepts. I went through several rounds of “What do they need to know before they can understand this? Did I cover it? Is there a simpler way to explain it? How about even simpler than that?” It was painstaking, and the temptation to hand-wave through details is high.
Is there anything else you’d like to say?
I’d like to give a shout out to PyCon and encourage everyone of any skill level to attend. The Python community is top-notch: really friendly and they put real effort at lowering the barrier to entry for folks interested in programming.
Thanks so much for doing the interview!