Latest / Talk Python To Me / #106: Invent your own computer games with Python
Transcript
- 0:00Al Swiger is back on Talk Python. This time we're inventing our own computer games.
- 0:05Has anyone ever asked you for a resource to get started on how to learn programming or
- 0:09how to learn Python? Well, one excellent and fun option is Al's book, just updated,
- 0:15called Invent Your Own Computer Games with Python. And we'll be digging into it this episode.
- 0:20It's Talk Python To Me, episode 106, recorded March 20th, 2017.
- 0:26Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries that
- 0:56ecosystem, and the personalities. This is your host, Michael Kennedy. Follow me on Twitter,
- 1:00where I'm @mkennedy. Keep up with the show and listen to past episodes at talkpython.fm,
- 1:05and follow the show on Twitter via at Talk Python. This episode is brought to you by Intel and Get
- 1:12Stream. Be sure to check out what they're offering during each of their segments. It helps support the
- 1:16show. Hey, everyone. Before we get to Al, I want to share three pieces of news with you.
- 1:21First two, I've launched two new courses this week. The first one, I partnered with Dan Bader,
- 1:27and it's called Managing Python Dependencies. This is a deep dive into how you need to manage your
- 1:34dependencies in Python, understanding pip, understanding requirements, and actually figure
- 1:40out what makes a good dependency in the first place. How do you search through all the possible
- 1:45packages on PyPI and other locations and determine which dependency you should even take? You'll learn
- 1:51all of that and more. You'll go from basically writing scripts and little utilities to building
- 1:56proper applications by mastering dependency management. Another new course that I wrote is
- 2:02Using and Mastering Cookie Cutter. If you want to help users fall into the pit of success when they get
- 2:09started with your project or your library, having a cookie cutter template that sets everything up just
- 2:14right for them is a really good option. So if you want to learn about cookie cutter, how to consume
- 2:20it as a user, how to create cookie cutter templates as maybe a project lead or something like that,
- 2:25and even modify and contribute back or just customize for your own purposes, the cookie cutter project,
- 2:31then you should check out Using and Mastering Cookie Cutter.
- 2:34And the final piece of news is we're now offering course bundles. If you come to training.talkpython.fm,
- 2:40you can buy an entire year's worth of content. So make this year the year you grow as a developer and get a year's worth of Python training guaranteed. Now let's talk to Al and check in on his cat.
- 2:53Al, welcome to Talk Python.
- 2:55Oh, it's great to be here.
- 2:56Yeah, it's great to have you back. It has been a long time since we talked about your huge cat.
- 3:00Oh, yeah. Yes, she is slightly less huge these days. I put her on a diet.
- 3:05Your cat's on a diet. How awesome.
- 3:07Yeah, she's, well, still kind of a bowling ball, but yeah, she's doing great.
- 3:14I know you were on show, I think it was show 19. I'm just doing that from memory, but certainly around that era. But I suspect many people listening now don't remember the story. So maybe let's talk about how you got into programming and how you got into Python and just start from there.
- 3:29Well, yeah, I always say that I hate telling people how I got started into programming because I was one of those kids that learned how to program in about the third or fourth grade, just programming in basic, making little computer games.
- 3:42And I hate telling people this because it sort of reinforces that idea that unless you were programming, you know, from when you were a toddler or something like that, that you'll never catch up and there's too much to learn and you're too old to start learning to program, which is really nonsense.
- 3:57Yeah, I think everything that I learned about coding from like third grade up to graduating high school when I was like one of those computer kids. I'm pretty sure anybody with, you know, the internet and Google and Stack Overflow can learn everything I learned in like maybe a dozen weekends.
- 4:14Yeah, maybe just YouTube alone would take care of it.
- 4:16Yeah, yeah. I mean, learning to program is so much easier today than it was 10 years, 20 years ago. Whenever I say like, oh, I've been programming since I was in the third grade, that's fairly meaningless these days. And so, yeah, I don't want to discourage anybody from learning that. And also whenever anybody says, I've been programming since I was, you know, 10 years old or something like that, I keep thinking, well, yeah, but it was probably pretty lousy programs that you were making.
- 4:42It's true.
- 4:43Just like I was.
- 4:43Yeah, you know, what's really interesting about when you stayed experience in those terms is you could have been working for two years, but on like a massive wide range of technologies and really throwing yourself into it.
- 4:57Or you could have been programming for 20 years, writing basically the same code. And I would put my bet on that two year person being able to do more in the industry, having that experience. And if you just keep doing the same thing.
- 5:08So there's quite a lens you have to put on. Like I've been doing it for 20 years or 10 years or whatever, right?
- 5:14Yes, definitely. And the one constant in this industry is that you're always going to have to be learning new things pretty much nonstop. So the feeling that you're really dumb and you know nothing is never going to really go away. So just get used to it.
- 5:28Yeah, that was my Saturday morning. Saturday afternoon, I felt a little bit better about life. But Saturday morning, I was like, Oh, gosh, really? Why can't I make this work? This is killing me.
- 5:38So yeah, it's a never ending thing, which I think is what's wonderful about the programming industry. But if that's not your thing, then you're not going to love it, are you?
- 5:46Yeah, I mean, certainly a lot of wheels get reinvented. But I think that there is measurable progress being made. I mean, you can just do so much more with software libraries and tools today. And yeah, so I very much encourage people to continue to or just pick up learning how to program. Or maybe if you tried picking it up like a decade ago, and you thought it wasn't for you, just give it another shot.
- 6:10Yeah, absolutely. You know, one of the things I think is interesting is you talked about how the tools weren't really that great to write software when you got started. And I suspect I'm just assuming but the scope of the things that you created was pretty narrowly focused, right? You weren't like creating YouTube, or Dropbox, or something like that, right?
- 6:29Right.
- 6:30I mean, it feels like on one hand, the programming tools and languages have got so much better. And yet there's more programmers, and we still work hard. Like, why do you think that is?
- 6:40Well, I think it's just the scope of things that we build are so much greater. This for the last couple of weeks, I've been learning bootstrap. And this is a JavaScript and CSS framework for basically creating modern looking websites. You know how websites usually have like the giant image on their front page.
- 6:58Yeah, and then they have like another row with like three little images in a row. And then they have like another row. And you can sort of tell like, oh, this is sort of a website created with bootstrap. But the reason that all these websites look that way is because bootstrap makes it really easy to make this reactive website that looks great on your desktop, but also great on your mobile phone.
- 7:18And it's doing a lot of busy work behind the scenes to make that happen. But using bootstrap on the other hand, is really I mean, I'm really impressed by how by how simple and easy it is to pick it to pick up and start using. And meanwhile, it's doing something that if I were to try to do it on my own would just be weeks and weeks and weeks per web page or per site or anything like that.
- 7:43You'd have to learn about reset CSS is about media queries, about poly fills for different. It's just like, oh, like all that stuff is gone, right? So now we can focus on building something.
- 7:53The design is kind of solved a little bit. I mean, it's still a challenge. But right. So we would look beyond those problems and say, okay, now what is the actual problem we're trying to solve? Right? And I totally agree that this is.
- 8:05There's in my opinion, there's no danger that we are going immediately out of a job.
- 8:09Oh, definitely. I remember, like, I think sometime in the early 2000s, I was in a coffee shop and I was overhearing somebody talking with some software developer and they asked him, like, I don't know, like, do we need more software? Like, when do we like, will we always need more software? And I kind of thought it's sort of like, well, I don't know.
- 8:29Will we need more novels? Or will we need like more movies? Or, you know, it's like, oh, we already have this detective story. I think that entire genre has been filled by this one book.
- 8:39So yeah, I mean, in a sense, you know, we're always going to be creating new word processing applications or new instant messaging applications.
- 8:47But there's a lot of stuff. And I think we just sort of take it for granted and forget that it's there in the same way that fish just forget that water is wet because we get so used to it.
- 8:57But I mean, like, all these modules like jQuery is what made JavaScript programming so much easier. And even things like Python is just making programming in general so much easier compared to working with C++ or older languages.
- 9:11A lot of busy work that you would have to do as a programmer writing code in assembly is just taken care of for you so you can concentrate on what makes your application different.
- 9:22Yeah, come to think of it, I haven't allocated or deleted any memory in quite a while.
- 9:25Awesome. So people may remember from episode 19. I'm pretty sure that's right. But why don't you tell everyone what you do day to day these days? Like, what do you do for a job in addition to writing books about inventing games?
- 9:39So I wrote those books and then started self publishing them while I had a full time job as a software developer. And about three years ago, yeah, I think it was 2004 was when I took the plunge and I was in the middle of writing automate the boring stuff.
- 9:55And I was fairly certain that I was going to be past deadline on that. And I was just everything was was working out well for me at that point where I thought like, okay, I can leave this job and continue writing full time.
- 10:08And I think automate like, you know, came out later that year or sometime 2005, I believe. But yeah, it worked out that I could finish this book. And if it was really successful, maybe I could continue writing more books. And if it wasn't, then I was in a position where, you know, just being in San Francisco as a software developer, it wouldn't be that difficult for me to get a new job. I'm always blown away by how successful automate the boring stuff has been.
- 10:35Yeah, that's a great book. And that was the topic of our first episode that we did together. Somebody recommended I reach out to you because they thought your book was so cool. And so maybe tell people, you know, what's the elevator pitch on automate the boring stuff?
- 10:47So automate the boring stuff is a book that teaches non programmers and office workers how to code and also how to do really practical tasks. So the one story that I think of is I had a friend who worked in an office and part of his job was
- 11:04just opening up PDF files and then finding this one line in each of these PDF reports and copying and pasting it to an Excel spreadsheet and then just opening the next PDF and just doing this for four or five hours at a time.
- 11:17And it's something that he taught himself a little bit of Python coding and grabbed a whole bunch of modules like he doesn't know the PDF file format, which is insanely complex, but he can learn how to use this PDF module for Python to grab this text and then update an Excel spreadsheet.
- 11:34And it took several hours to write this, but running it now, you know, it takes a few seconds to do all that work that normally would take him hours and hours.
- 11:45And I realized that, you know, a lot of people were saying, oh, everyone should learn how to code.
- 11:48And I sort of thought, well, what exactly could you do if you weren't a software engineer, but, you know, you do work with a computer every day.
- 11:56What are the things that you would want to do to using programming to help just free yourself from a lot of tedious tasks?
- 12:04And so that's sort of the first half of automate the boring stuff with Python is a general Python and programming tutorial for complete beginners.
- 12:11And the second half just covers a whole bunch of useful modules that the Python community has created.
- 12:16Right. And just little tasks that you could automate in your life that, you know, maybe you have somehow, right?
- 12:21Yeah. Oh, yeah. Yeah.
- 12:22Nice. So I think that's a great idea.
- 12:24And when I hear people say that we need to teach everyone to code or coding is a core skill like math and reading.
- 12:31I do feel that that's true, but I don't feel like we need 10 times the programmers.
- 12:37I feel like instead, like having some sort of programming skill amplifies whatever you actually are good at.
- 12:44Right. So if you're if you're a biologist, you're going to be a really effective biologist if you can automate things.
- 12:51Right. If you can use a little Python to like not do stuff by hand and collect a bunch of data and whatnot.
- 12:57Same for finance, same for whatever. Right.
- 12:59Oh, yeah. And today, most people who want to gain more technical skills are pretty much doing programming, except they're doing it with Excel.
- 13:07Essentially, just like creating really complicated spreadsheets to manage large amounts of data and then using these complex formulas.
- 13:14And, you know, that's a great thing.
- 13:16And but also a terrible thing because, oh, my God, that code.
- 13:18But, you know, actually sitting down to learn a programming language like Python makes, you know, doing these tasks so much easier for them and also, you know, produces very readable code.
- 13:28And it's possible to share this these small scripts with other people.
- 13:33And also, I guess the same is done with Outlook mail rules.
- 13:37Like I remember at my at the last job I had, you know, I would get about 150 or 200 automated emails for different things every day.
- 13:45And it would be completely unmanageable, except I just set up, you know, a dozen or so Outlook rules where, you know, if I get an email from this email address with this in the title, like search for this substring, filter it to this folder and just doing that over and over again.
- 14:01Well, I mean, that's essentially the nature of programming.
- 14:04You're trying to program this logical intelligence to do all this tedious work for you.
- 14:10Yeah, I think that's a great example for people who are getting started.
- 14:13Right.
- 14:13I think I have a ton of Gmail rules as well.
- 14:16Very nice.
- 14:17So maybe we should start by getting start getting into your book.
- 14:21So you have a number of books and one of them you just released the fourth edition and it's called Invent Your Own Computer Games with Python.
- 14:29Right.
- 14:30Yes.
- 14:31Yeah, it has an absurdly long title, but it was the first book that I ever wrote.
- 14:37And I put book in quotes because it was sort of just a series of web pages that I had.
- 14:44And I just started putting chapter numbers on them eventually and then created a self-published book for it.
- 14:50So I thought like, I don't know, it's sort of like Invent Your Own Computer Games with Python.
- 14:53And I didn't realize like, you know, I was like, oh, if I'm going to make this a commercial book, maybe I should come up with a snappier title.
- 15:00But it became popular.
- 15:01And so that was sort of the title I was stuck with.
- 15:04No, I think it's a good title.
- 15:05It's pretty descriptive.
- 15:06It's not too long.
- 15:08So I know not everybody gets into programming because they want to create computer games.
- 15:13Like I don't feel like I personally got into programming to create computer games.
- 15:17I was, I came more, I think I came at it a little bit later.
- 15:20So I came at it from a, hey, I have these research problems in my PhD program I got to work on.
- 15:25So let's try to solve those or even in undergrad.
- 15:28But a lot of people do want to build games, especially younger people.
- 15:33Right.
- 15:33And so, so what's the audience look like for your, your book?
- 15:38The current audience, it's actually quite a wide range of readers, but the intended audience is roughly maybe as young as nine years old.
- 15:46But sort of, I always pictured invent your own computer games with Python as the book that I wish I had read or I had when I was young.
- 15:56Because I remember there was like only very few books on programming in BASIC that I had access to.
- 16:01And there were so many different versions of BASIC that, you know, some of the programs didn't work and I really didn't have, there was no real internet to Google for answers.
- 16:10So I wanted to just get a broad range of different types of games.
- 16:15And so that's why the book ended up with over 20 chapters of, of games in it.
- 16:20Yeah.
- 16:21I think that's really cool.
- 16:22Yeah, it was just, I wanted a book that went from knowing absolutely nothing to being able to make some like really like clever little games that wouldn't take up that much time.
- 16:31You know, it wouldn't take like a week to write.
- 16:33Games are a great sort of gateway into the world of programming.
- 16:37Like I really didn't have that many ambitions of becoming a professional game developer, but learning how to program games just because I was really into Nintendo as a kid became this, it was the main motivating force for me to get into programming.
- 16:51And then later on become a software developer.
- 16:53Yeah, it's cool.
- 16:54And each little chapter is pretty small and everyone has a different game or most of them have different games where there's kind of a quick win.
- 17:03And I think when you're learning programming, that's so important because you can spend all your time going, here's how you declare variables.
- 17:10This is what a type is.
- 17:11This thing is an integer.
- 17:12That thing is a string.
- 17:13This is a loop.
- 17:14This is the function use the def word, but you think it's like, oh my gosh, like why do I care about this anymore?
- 17:18I thought this would be fun and it's not fun anymore.
- 17:20Right.
- 17:21So how do you solve that?
- 17:23Do you think, like, how did you address that at least in your, your book?
- 17:25So in my book, and I really am copying what a lot of like bite magazine from the eighties, which would have just listings of source codes of source code for a small game.
- 17:36That you would just copy from the magazine.
- 17:38There were also a lot of.
- 17:39Maybe even type it in, right?
- 17:40Yeah, yeah, exactly.
- 17:41And I believe, Atari archive.net or Atari, Atari archive.com is a website that has a lot of these old basic programming books that you can view online now.
- 17:53And I thought it was just great because none of the programming books that taught me like, these are variables, these are loops and everything.
- 18:00Like I had the reference manual, but that didn't show me anything.
- 18:03I couldn't make heads or tails of it.
- 18:05But I found one book that basically taught by showing the complete source code to a small game and then just sort of explaining how it works.
- 18:13And as I was writing, invent your own computer games, I realized with Python, if anything, this is way easier than with basic because the code is much more direct and much more simple than having to, you know, sort of, there's still a lot of hoops that you would have to jump through through basic, even though basic was revolutionary for its time as being a simple programming language.
- 18:32Right.
- 18:33Still, it didn't have much of a base library that you could leverage.
- 18:36There's a lot of stuff you had to do yourself, right?
- 18:39Yeah.
- 18:39Nice.
- 18:40So you start out in this thing by explaining a couple of pieces, like what is the REPL?
- 18:46What is the interactive shell?
- 18:48How do you write programs?
- 18:50What is a variable?
- 18:51It's interesting.
- 18:52When I started doing training for software developers, I always, my first concern was I'd end up in a classroom of super smart people and they would ask me all these hard questions and I would not know the answer.
- 19:04And I would look stupid or they would feel like they didn't get their money's worth or whatever.
- 19:09What I found was those people are super easy to talk to because you are speaking the same language.
- 19:17But when you are speaking to somebody who's just getting into programming, like many of the people reading a book, that is a much harder conversation in my mind.
- 19:26And I think you did a pretty good job.
- 19:27But like even talking about what is a variable and how does code execute?
- 19:32I think it's easy to just go, well, it just does.
- 19:35You just run it or whatever.
- 19:37Right.
- 19:37Like, like, was it easy for you to explain that stuff in a way that you felt conveyed it to newcomers?
- 19:43I mean, I think my main approach to that was just for, I would write out sort of a map of all the topics that I wanted to cover and then just start drawing lines between them saying, like, in order to understand this, they have to understand this other concept and in order to understand that.
- 19:58So I would sort of get this dependency graph of concepts.
- 20:01And a lot of times I really am just sort of tempted to just say, like, well, it just works like this.
- 20:07But the great thing about Python's interactive shell with the REPL is you kind of can get away with saying, well, this is just how it works by showing an example in the interactive shell.
- 20:17Like, oh, type this in and then it spits this out.
- 20:19And it's surprising how just having this sort of visible example that they can see and then you can show, like, oh, you can type, like, 2 plus 2.
- 20:28And then you can also type 2 plus 2 plus 2 and then just sort of explain that, like, well, 2 is just a value.
- 20:34Like, this is kind of like math problems in your math class, except if you think of these numbers as values and those plus signs as operators, you can see that this is an expression which just combines those and evaluates them down to, like, a single value like 6.
- 20:47But I really lean heavily on the interactive shell for just demonstrating this because the last thing I want to do is just sort of talk about these concepts instead of actually showing, you know, what the computer does when you type in these instructions.
- 21:03Yeah, that's the best way, right?
- 21:04Is you have to just do the thing if you want to learn programming.
- 21:08It's kind of unique in that sense.
- 21:10I guess math.
- 21:12If you're trying to learn advanced math, you can't just read a bunch of math and then, like, be able to solve problems.
- 21:16You probably got to just do it as well.
- 21:17But it's certainly one of the disciplines where you have to sit down and do the thing and experience.
- 21:24So the REPL seems like a great way to do that.
- 21:26Yeah, I mean, the great thing about computers is they do exactly what you tell them to, and that's also one of the worst things about them.
- 21:32The most frustrating things ever.
- 21:34It is much nicer to learn how to program, you know, with the computer right there in front of you telling you when you get things wrong as opposed to, I don't know, if you just checked out a calculus book from the library and tried to learn calculus.
- 21:45I mean, you have this sort of inert book sitting in front of you, and maybe you're doing the math right, maybe not.
- 21:51It's hard to tell because, you know, maybe you have just the answers in the back of the book for the questions in the math book, but you don't have, whereas the Python interactive shell, it'll always be able to tell you, like, oh, this evaluates to that or this raises such and such exception.
- 22:06Yeah, exactly.
- 22:07The only one that's hard to get it to give you an answer is infinite loop.
- 22:09Oh, yeah.
- 22:10Well, you know, you just have to wait a while.
- 22:12Exactly.
- 22:13I'm just going to wait for a little more time.
- 22:15So one of the things that you used in the book was Idle, the graphical tool that comes with Python.
- 22:22Why did you pick that over some other tool?
- 22:26Like, I know the book was written a little while ago, so maybe those were some of the better UI tools, or what was the story there?
- 22:34Oh, I wouldn't say that.
- 22:36So Idle has, I would say, two things going for it.
- 22:39I mean, it is sort of like a very rough IDE, and it's more text editor than IDE.
- 22:44But the great thing about it is that it's really simple.
- 22:47You can just fire it up, and it has the interactive shell in one window, and it has a file editor in another window.
- 22:54And you can just press F5 to run your program, and it's really easy to get started with.
- 22:59And then the second thing is also that it comes with Python.
- 23:02There's nothing extra that you have to install.
- 23:05You don't have to configure any environment variables.
- 23:08You don't have to navigate your file system to find the, you know, Python.exe or the Python interpreter.
- 23:14And this is actually a pretty big deal, especially if you've ever had to teach Python or teach programming in a classroom setting,
- 23:22where now you have 15, 20 laptops that you have to set up, and maybe you don't have all the permissions
- 23:28because the school district or the IT department decided to lock down all the permissions on things.
- 23:34It just saved me a whole lot of steps where I wouldn't have to talk about, like, here's how to install Notepad++ if you're on Windows.
- 23:42But if you're on Mac, then here's how to install PyCharm, and here's how to set it up, and all these other steps.
- 23:48And I really feel like Idle is one of the reasons why Python...
- 23:53I mean, there's lots of reasons why Python is so popular, but Idle is certainly one of them.
- 23:56It makes Python a language that's easy to get started with.
- 24:01And the more of that you have for any language, the more adoption you're going to see,
- 24:04and the bigger of a community that you're going to create.
- 24:07Yeah, I see.
- 24:08So it's in your Start menu, it's in your Applications folder, or whatever, right?
- 24:13And it's...
- 24:14Once you run it, the path is there, right?
- 24:16It's not like this environment variable is not set up, or whatever.
- 24:20Okay, that's a pretty good reason, actually.
- 24:22We all love Python for its tremendous productivity benefits, but getting the best performance takes some work.
- 24:42What if you could get out-of-the-box, easy access to high-performance Python?
- 24:47Intel Distribution for Python developers delivers just that.
- 24:50Get close to 100 times better performance for certain functions when using NumPy, SciPy, scikit-learn,
- 24:56linked with optimized native libraries like Intel Math Kernel Library,
- 25:00access-efficient multithreading, and Python projects like Numba and Scithon.
- 25:04Try the Intel Distribution for Python and experience performance today at talkpython.fm/intel.
- 25:10And profile your Python and native C, C++ applications for performance hotspots with Intel VTune Amplifier.
- 25:18With Intel, it's all about performance.
- 25:20Do you think that Python would be better off if it had something like Swift Playgrounds?
- 25:33Do you think that matters?
- 25:34Oh, like what?
- 25:35Like Swift Playgrounds.
- 25:37Are you familiar with those?
- 25:37Oh, no.
- 25:38No, I'm not.
- 25:38So, Swift Playgrounds, basically, it's kind of like a REPL, but on the right-hand side,
- 25:42you can have, like, graphs and little animations.
- 25:46Oh, okay.
- 25:47And you've got the code, like, on the left and on the right, the output of that code going down together.
- 25:54Interesting.
- 25:55I think, like, IPython Notebook is sort of similar to that.
- 25:59Like, it can have non-text output.
- 26:01Yeah, IPython is the closest I can think to it.
- 26:03But, you know, IPython is not something that's super easy for beginners to set up.
- 26:08Like, tell somebody, like, you have Python, now get IPython running on Windows.
- 26:12You know?
- 26:14Right.
- 26:14Yeah.
- 26:15Well, the problem is I can't find vcvars.bat or whatever that thing is, right?
- 26:19Oh, vcvars.bat.
- 26:21Yeah.
- 26:22Yeah.
- 26:22You're like, oh, okay.
- 26:23Forget it.
- 26:23I don't know.
- 26:24I'm just, I feel like there's Idle, and if, like, Idle was taken to the next level, it would look a lot like Swift Playgrounds.
- 26:30And I'm wondering if something easy and built in there was really, really slick.
- 26:35Whereas it feels like it's effective and it's nice, but it's not really slick these days.
- 26:39Yeah.
- 26:40Well, I mean, Idle is definitely sort of showing its age.
- 26:43But in a certain sense, it is fairly timeless where it just has the, its simplicity means it can get away with just having the interactive shell and the file editor.
- 26:52And it's perfect to work with.
- 26:54It is also, I guess, somewhat controversial to just sort of add an application with your programming language.
- 27:01But I'm really, or even something like a GUI toolkit like TKinter that was added to the Python standard library.
- 27:08I don't really know of any other programming languages that sort of do that with their standard library.
- 27:13But I'm certainly glad that that happened, that ended up happening.
- 27:17Yeah, it was definitely nice for your game, right?
- 27:18Yeah.
- 27:19For your game book.
- 27:20Oh, yeah, definitely.
- 27:21Nice.
- 27:21So you want to touch on some of the games that you take people through?
- 27:24I mean, obviously, you have the requisite guess a number high-low game to start.
- 27:29Yes.
- 27:30I mean, that's, that's something that I've seen over and over and over again.
- 27:33Even when I was back first writing this book, I felt like, okay, guess the number is perfect.
- 27:37It has loops and if-else and variables.
- 27:40And it's also just kind of like a fun little game where, you know, you can say like, oh, 10.
- 27:46Well, my number is higher than that.
- 27:48And so you can sort of do this dictionary style.
- 27:51Yeah.
- 27:51Binary search.
- 27:53Sorry.
- 27:53Yeah.
- 27:54Yeah, exactly.
- 27:54Yeah.
- 27:55You're unwittingly, like the optimal strategy is the binary search for humans.
- 27:59I do feel like that's one of the games that is like on a per line of code, like is the most dense in like fun and joy, right?
- 28:07It's like what, like eight, nine lines of code probably.
- 28:10Oh, yeah.
- 28:11And people can actually get some anticipation and something out of it, which is pretty cool.
- 28:15Yeah.
- 28:15And so the book, that's the first program in the book and it continues on with, there's like a little joke telling program.
- 28:21I mean, so there's not all the chapters have game programs.
- 28:24Some of them are just sort of like fun little programs to run.
- 28:27There's this joke telling program, which is really there just to get familiar with how to output text in certain ways and format the text.
- 28:35And then next is a game called Dragon Realm, which sounds really fancy.
- 28:40But actually, if anything, it's even simpler than the, I guess, the number game.
- 28:44Is that like a mud?
- 28:45Oh, well, I mean, it would look like it, but really it comes down to pick cave one or cave two.
- 28:51And then it tells you if a dragon has eaten you or not.
- 28:54Yeah, it's like one step in a mud.
- 28:58Yeah, it's a coin flip, but it has like a really nice user experience tied around and story behind that.
- 29:04Kind of like a lot of modern games where as long as you have a great story, we don't care if the game itself is kind of dull.
- 29:11Yeah, exactly.
- 29:12Exactly.
- 29:13Yeah, I like the retro game experience where they specifically sort of water down the graphics and make it about the game experience and the story.
- 29:23And it's kind of nice not to have like always the most shiny, shadowy, reflected on water graphic engine.
- 29:30Right.
- 29:30With nothing else to it, you know.
- 29:32I definitely grew up with muds and sort of text adventures and that style of games.
- 29:38And invent your own computer games with Python similarly has just text based programs for I think the first major chunk of the book in the last four chapters starts covering Pygame and 2D graphics.
- 29:50But the great thing about having text only for just, you know, having keyboard input from the user and then all the output is just print statements is that you can always tell from the output that you get from the program where that came from in the source code.
- 30:05So you can sort of like draw a line like, oh, okay, this text here that says the dragon ate me comes from this line, which is print the dragon ate you.
- 30:12And so you can actually sort of see the flow control going through the program.
- 30:17Whereas, you know, a lot of I don't know if you like fire up Unity 3D or something like that or just these really complicated game engines.
- 30:25It's kind of hard to figure out what part of the code causes what to happen on the screen.
- 30:31Oh, yeah.
- 30:31Those 3D versions get so, so intense.
- 30:35I remember I had done a 3D simulator in OpenGL and I couldn't see the thing that I was trying to display on the screen.
- 30:41I'm like, I know it is in front of me.
- 30:43Why can't I see it?
- 30:44And I had like back face culling turned on and I had gotten clockwise versus counterclockwise backwards.
- 30:53Oh, right.
- 30:53So it thought I was inside the thing and it just took it.
- 30:55I guess it was and it took me, I remember hours of like, why can't I see it?
- 31:00And it should be counterclockwise, not clockwise.
- 31:02It doesn't.
- 31:02It only draws one side of the triangle that you're looking at.
- 31:05So if you look at it from the other side, it disappears.
- 31:07Exactly.
- 31:08Why am I looking at the inside of this, not the outside of it?
- 31:11Yeah.
- 31:11So it certainly, I don't think that's a good place to start, even though like people, many people where I think, oh, I'm going to create Eve online.
- 31:17I'm going to create some kind of unreal thing.
- 31:20It's effective, but it's also not so, I don't know.
- 31:24It's not as much fun as it sounds like in the end, in my estimation.
- 31:28Yeah.
- 31:29I mean, actually, so I'm working on a book right now for No Starch Press because I do some teaching classes with kids and they say like, I want to program Minecraft.
- 31:38Minecraft is like the main game that I hear over and over again.
- 31:42And I'm just like, oh, yeah, well, that's going to be a lot of work.
- 31:47But the next book that I'm writing, which so far doesn't have a title, but I'm roughly calling it Programming Robots in Minecraft, is a book that covers this one mod for Minecraft called Computer Craft that adds in these programmable robots into the game world.
- 32:02And so you can write these Lua scripts to program these robots.
- 32:06And they're called turtles, just like the old logo turtles that do drawing on the screen.
- 32:11So you can program these robots to just like move forward, move, you know, turn left, move forward again, start mining in front of you.
- 32:18And you can basically have these robots sort of do all of your mining or chopping down trees or tending to a farm or building for you.
- 32:27I jokingly call this book Automate the Minecraft Stuff with Lua.
- 32:32And so I was hoping like to use this, getting kids who are really interested in Minecraft into programming, once again, using games as sort of a gateway into that.
- 32:43The broader world.
- 32:43Yeah, absolutely.
- 32:44Yeah.
- 32:44I'm just really sad that it's all in Lua instead of using Python.
- 32:49But Lua is also.
- 32:50Is there some sort of, yeah, is there some sort of Python adapter you could do?
- 32:53There is a Python module.
- 32:56In fact, I think NoStarchPress has a book called Learn to Program with Minecraft that uses a Python module for Minecraft.
- 33:04It's more like a sort of a 3D editor.
- 33:07Right.
- 33:08Using in the Minecraft world.
- 33:09So you can specify like XYZ coordinates and then change that block to something else.
- 33:13But it's great because now you can just sort of instantly build giant creations by writing code.
- 33:20Sort of like, you know, computer generated art.
- 33:22Yeah.
- 33:22You have these computer generated blocks now.
- 33:24Okay.
- 33:25Very cool.
- 33:26Have you seen the movie Indie Game?
- 33:28I-N-D-I-E?
- 33:30Indie Game?
- 33:31No, I haven't.
- 33:32And there's Indie Game and then there's like a sequel.
- 33:34And I think it's on Netflix and other places.
- 33:36But it follows these four or five groups along who spend like a couple years doing just solo Indie Game development.
- 33:44And either they're a great success or not so much at the end.
- 33:47And it's, yeah, for people who are interested in this kind of stuff,
- 33:51that might be a good movie recommendation.
- 33:53Oh, yeah, definitely.
- 33:54I mean, I keep thinking like, I hear about Minecraft and Dwarf Fortress and a game that I recently got into, Stardew Valley.
- 34:01And these are all created by sort of like solo or just like very small teams of people, usually one person, just over years.
- 34:09And there were just these big labors of love that turned into this great thing.
- 34:12And I was thinking like, oh, man, I could totally just spend the next four years of my life just sitting in a small room.
- 34:19And I'll program something that's like a cross between Stardew Valley and Minecraft.
- 34:22And I'd call it StarCraft.
- 34:25There's no trademarks or anything.
- 34:26It'll be great.
- 34:26Nice.
- 34:27Yeah.
- 34:27I saw one of the guys that was on there.
- 34:28He was featured on the Apple App Store with his sequel game.
- 34:33So he must have gone somewhere with that.
- 34:35That's cool.
- 34:35Yeah.
- 34:36So that's great.
- 34:36So what other games do we have?
- 34:38We have Hangman, of course.
- 34:39Yes.
- 34:40Yes.
- 34:41And this game actually is sort of like the first major game in the book.
- 34:44I've actually spread it across a couple chapters.
- 34:46And I also talk about how you should write out flow charts for sort of designing what you want your program to do and how, you know, it's a lot easier to just change a flow chart around than it is to actually start changing code around if you later, like, come up with a better idea or something else like that.
- 35:03So just doing a little design ahead of time and thinking about code before you start writing it.
- 35:09Yeah.
- 35:09You probably wouldn't do that too much as a professional developer these days.
- 35:12But certainly when the concept of, you know, what is a function again?
- 35:16Right.
- 35:17When you're at that level, it does become hard to manipulate the code and whatnot.
- 35:23So having it drawn out is nice.
- 35:25Yeah.
- 35:26And also it's just a flow chart is just sort of a natural way of depicting the flow of execution through a program.
- 35:34Nice.
- 35:34Okay.
- 35:34So tic-tac-toe, does it play against you automatically?
- 35:38How do you play tic-tac-toe?
- 35:39Tic-tac-toe.
- 35:39So this is a tic-tac-toe game against the computer and the computer is actually somewhat intelligent.
- 35:44So it'll look, if it can win the game by making a move, it'll make that move.
- 35:48And then it'll check if it can make a move that will block the player from winning the game, it'll make that move.
- 35:53And then I think the algorithm goes on where it'll take any corner space that's free and then any side space that's free.
- 35:59Or I think maybe it takes the center first.
- 36:02But I really wanted to introduce the idea of you can actually have, you know, again, it's still just a bunch of function calls and if-else statements.
- 36:11And sort of also the first time where I introduce a data structure, we have a data structure to represent the tic-tac-toe board.
- 36:18And this data structure is what's used by a bunch of the functions to sort of plan out what the AI will do.
- 36:24I remember trying to program this as a kid in BASIC by following some source code that I was copying and I could never get it to work.
- 36:33I would just like try it and then like a couple weeks, you know, forget about it and a couple weeks later I would try it again and it would just never actually work out.
- 36:41And so when I was writing this originally for the, I guess, seven years ago I think was when I first started writing this book.
- 36:48It was kind of like a miniature triumph that I got the tic-tac-toe program working.
- 36:54You will not haunt me anymore, tic-tac-toe.
- 36:56We're done.
- 36:57Yes.
- 36:57I have produced my masterpiece right here.
- 37:00Yeah, that's awesome.
- 37:02But yeah, and the game continues on.
- 37:05I have like a few other games.
- 37:06There's like a deduction game called Bagels.
- 37:09It's also called Mastermind where it's sort of your, it has three numbers and it tells you guess which numbers and it gives you clues where like if you've guessed one digit or if you've guessed a digit but it's in the wrong place.
- 37:21That sort of deduction game.
- 37:23And then I also have a small chapter on the, on a little encryption cipher program so that you can do the Caesar cipher cipher, whereas, which is where you shift the letter over by three characters.
- 37:36So like an A becomes a D and a B becomes an E and then you decrypt it by just shifting the letters back.
- 37:42But this was just like a really simple sort of like encryption program that you could make in Python.
- 37:49It's not necessarily a game.
- 37:51I thought it would just be like a really fun thing.
- 37:54This episode is brought to you by GetStream.
- 37:57If you're building an application that has some form of activity stream like you might see in Slack or Facebook or Instagram and others, then you owe it to yourself to have a look at GetStream.
- 38:07They provide scalable, reliable, and personalizable hosted API feeds as a service.
- 38:12The feed is the most intensive component of these types of applications.
- 38:16Yet there's no need for you to reinvent the underlying feed technology when GetStream has the infrastructure and a Python API already in place.
- 38:24Go from zero to scalable feed in hours, not weeks or months.
- 38:28They even use advanced machine learning to serve up personalized results to each and every user.
- 38:33Stream powers the feeds for over 500 companies including Makerspace and Fabric with a total of 70 million end users.
- 38:41Try the API yourself in a short five-minute interactive tutorial at talkpython.fm/stream.
- 38:48Try it for yourself.
- 38:49It helps support the show.
- 38:50Actually, this chapter sort of inspired me to go on later and I wrote an entire book full of these.
- 38:58in hacking secret ciphers with Python.
- 39:00Nice.
- 39:01Yeah, I think ciphers are another thing that are pretty fascinating to people.
- 39:04It's a parallel track to being interested in games.
- 39:07These secrets and these secret ciphers are quite interesting.
- 39:10Encryption is so complicated these days that it's not fun to look at anymore, but trying to solve things.
- 39:17Especially when one minor oversight means that your entire system can fall apart.
- 39:22Yeah.
- 39:23Yes.
- 39:23So I wrote an entire book of bad encryption in a modern sense.
- 39:27They're terrible ciphers.
- 39:28But these are all sort of like classical ciphers.
- 39:31Caesar cipher literally goes back to the times of Caesar.
- 39:34Was Caesar actually using it?
- 39:35Yes.
- 39:36So this was sort of the system where they would just shift letters over by three characters in the alphabet.
- 39:41And that was how they would encrypt things.
- 39:43Of course, back then, just writing things down was effectively encrypting things because most people were illiterate.
- 39:49But, you know, just the idea of you're just seemingly writing a bunch of nonsense onto writing that down.
- 39:55And then that, you know, anybody who intercepts that message would just be completely confounded because these concepts of encryption and, you know, treating letters as sort of generic symbols that can be manipulated according to some algorithm.
- 40:10That just wasn't really common.
- 40:11All that common.
- 40:12So, I mean, the Caesar cipher was very effective.
- 40:15Yeah.
- 40:15I mean, it just seems like so basic.
- 40:18And it's, you know, encryption for like a serious empire.
- 40:21Right?
- 40:22Yeah.
- 40:23Yeah.
- 40:23I mean, and so there are basically a few other different cipher schemes that came up.
- 40:29But really, I think it was the visionier cipher.
- 40:32I'm never certain if I'm pronouncing that correctly.
- 40:35And it's really the visionier cipher is sort of like the Caesar cipher, except slightly more complicated.
- 40:42And you have a different key for the first letter of, you know, if you have a key that's four letters long, then you have one Caesar cipher key for the first letter of a message.
- 40:52And the second letter, you have a second key in the third letter.
- 40:54You have a third key in fourth letter.
- 40:55You have a fourth key in the fifth letter.
- 40:57You go back to the first key.
- 40:58And this was really kind of brain dead simple, but it remained effectively unbreakable.
- 41:05They called it the indecipherable cipher in French, which I'm not even going to attempt to pronounce.
- 41:10But I think Charles Babbage solved it, but never published or was able to break these messages, but never published his method behind that.
- 41:20That's like back to the 1800s or something, right?
- 41:22Oh, yeah.
- 41:22Yeah.
- 41:23I think it came about in like the 16th century or so, I want to say.
- 41:27But for, you know, a couple hundred years, it was just unbreakable.
- 41:30But, you know, these days, like anybody with a laptop and a little bit of programming knowledge could write something that can just do all the number crunching that you have to do to come up with to be able to break these ciphers.
- 41:41So I wanted to sort of write an entire book on that.
- 41:44Oh, yeah.
- 41:45And so all of these Python books, you know, going from Invent Your Own Computer Games with Python, even the fourth edition and Automate the Boring Stuff and Hacking Secret Ciphers, I released under a Creative Commons license.
- 41:56So you can find them online at inventwithpython.com and they've been copied to other sites, I'm sure.
- 42:01I just really wanted to put this information out there and get it into the hands of as many people as possible.
- 42:08Yeah, that's great.
- 42:09And so people can go check it out and they can basically read it online there, right?
- 42:13Or they can buy the tree version or maybe even a Kindle version, huh?
- 42:17Yeah, yeah.
- 42:18And the Kindle version is slightly, it's formatted much, much more nicely.
- 42:21I just sort of have these HTML versions that I sort of hastily exported from Word.
- 42:27But, you know, so all the information is there, even if you don't have the funds to pay for an actual like dead tree book.
- 42:34And I get a lot of emails from sort of students and other people who are, you know, really thankful that information is there, that they can just read it off of their screen without having to buy a book.
- 42:44Yeah, yeah.
- 42:44That's really cool.
- 42:45Do you know if your book is being used in any like classes, like official classes?
- 42:51I do get some emails from a few teachers who say they're using sort of like invent with invent your own computer games with Python as part of a class.
- 43:00I never really wrote it sort of to follow a curriculum or to be teachable, you know, in 45 minute or 90 minute class period.
- 43:09But, you know, I'm really glad that, you know, it has some examples that they can pull out, especially being online and under a Creative Commons license where they can easily just copy and paste the sections they need and print it out as needed.
- 43:22So I'm really glad that it's just produced some material that teachers can make use of.
- 43:28Yeah, that must be really cool to think that there's probably kids out there learning through your book.
- 43:32And also really terrifying, just in case I have any typos or weird practices of mine.
- 43:38I should have actually made that more clear how this works.
- 43:41Don't actually do this for real people.
- 43:44So you kind of wrap up things by talking about Pygame and you even have another book on Pygame itself, right?
- 43:50Right.
- 43:51So Pygame is a 2D graphics library.
- 43:54It's Pygame's really a wrapper for another library called SDL that is very popular with programming 2D stuff with C++.
- 44:03But Pygame really makes creating sort of graphical games so much easier.
- 44:08You can just sort of point to a PNG image file on your hard drive and then just display it in a window and then start moving it around.
- 44:15And it can support mouse input and also play media files.
- 44:19You can play MP3s or WAV audio.
- 44:21And I once wrote a blog post a long time ago about professional games that actually make use of Pygame.
- 44:28I know that there's at least two or three of them that are on Steam, the PC game marketplace, that were originally just created in Pygame.
- 44:37So Pygame is mostly seen as sort of a, you know, just sort of like a toy hobbyist library, but you can actually make commercial games with it.
- 44:48That's really cool.
- 44:48Yeah.
- 44:48So a good 2D scroller might work well there, huh?
- 44:51Oh, yeah, definitely.
- 44:52Nice.
- 44:53Yeah.
- 44:53So at the end of Invent Your Own Computer Games with Python, I had a few chapters devoted to sort of just a very light introduction to Pygame, followed by one game programmed using Pygame.
- 45:06And I thought like, wow, I have a lot of other ideas for small games that I'd like to create.
- 45:10So I thought like, well, I guess I'm writing another book.
- 45:15And yeah, and so it was that was the second book that I wrote.
- 45:18It was also self-published.
- 45:19And then Hacking Secret Ciphers was self-published.
- 45:22And this was all, you know, just a spare time hobby of mine.
- 45:27But it was sort of this was what built up my confidence into thinking like, hey, OK, I have an idea for a book that could be really, you know, possibly really popular that I would want professionally published.
- 45:38And that's sort of when I approached No Starch Press about publishing Automate the Boring Stuff with Python.
- 45:44That's really cool.
- 45:45Was it weird?
- 45:46Like, when did you first start describing yourself as an author to other people?
- 45:50When they go, hey, what do you do?
- 45:52Like, I'm a programmer.
- 45:53Leave me alone.
- 45:54It's always been weird because I thought like, well, you know, it's just a self-published book is what I would always tell people.
- 45:59I guess it was really sort of with, you know, Automate the Boring Stuff.
- 46:03You know, I would go to Python meetups and people would know who I am because of that book.
- 46:08Or I would go to PyCon and people would have heard of me.
- 46:11And it's a strange feeling that never quite stopped being strange.
- 46:16Yeah.
- 46:16But, you know, it's also a great feeling.
- 46:18I remember I came over to see you at the No Starch Press booth last year at PyCon.
- 46:23And that's how I found you.
- 46:24Yes.
- 46:24At PyCon.
- 46:25Hang around with the books.
- 46:27Right on.
- 46:27Yeah.
- 46:28I remember at that PyCon, I had two people who wanted to take selfies with me.
- 46:33And so I kind of felt like a rock star.
- 46:35And it's, you know, I mean, our industry talks a lot about imposter syndrome.
- 46:40But I feel like I have enough experience under my belt right now that I still feel like an imposter.
- 46:46But I'm pretty sure I'll get away with it for the rest of my life.
- 46:49You've pulled it off for enough years that you think that the trail's gone cold.
- 46:55I am completely confident in myself that no one will ever find out what a fraud programmer I really am.
- 47:01Nice.
- 47:02So speaking of the trail, what books are you working on next?
- 47:07So, yeah.
- 47:07So I have the Minecraft book that I'm working on.
- 47:10And I keep coming up with ideas for, I don't know, like automate the boring stuff with JavaScript.
- 47:15Or maybe sort of a SQL to automate where you're using Flask to create really small applications.
- 47:23So, and again, this would be sort of for office workers who have something that they, you know,
- 47:28some custom software that they would like to have written that's really small,
- 47:31but they don't want to hire, they don't want to like contract out a programmer to write it for them.
- 47:36I was thinking like, well, you know, you could actually use Flask in the browser for all the UI components and everything like that.
- 47:42And I thought like, okay, that would be pretty good.
- 47:44And then I just keep poking around with other ideas.
- 47:47So, but for right now, the Minecraft book is the one I'm working on.
- 47:53And I'm also creating a website that is set up so that readers of that Minecraft book can then go on and write their own programs for Minecraft robots.
- 48:03And then go to this website to share their programs with a lot of people.
- 48:07I use this tool called Scratch from MIT in a lot of teaching to programming to kids.
- 48:14It's a great system.
- 48:16It's has sort of this like snap together block interface for creating games.
- 48:20I really like it.
- 48:21I used it for my youngest daughter's hour of code.
- 48:25I went in hour code in like elementary school for all the grades, eat one grade at a time.
- 48:31And we used it and I was blown away at how good the kids could do stuff with it.
- 48:35Oh, yeah.
- 48:35I mean, the one thing that I've learned is that especially young kids really have problems typing or, you know, they're just like pecking at the keyboard one key at a time.
- 48:43And it's really frustrating to type that slowly and then realize you left out a semicolon and now you get some weird error message.
- 48:50And Scratch fixes that with this snap together block system where it becomes literally impossible to make a syntax error in your code because the blocks just don't fit that way.
- 49:01And I just, you know, the more I used it, the more like clever design decisions I realized they had made behind the scenes.
- 49:07And the other great thing about Scratch is not only did they really nail down the editor, but the Scratch, Scratch runs in a web browser.
- 49:15And also it has a website where you can share all of your programs with other people and also view the source code of other people's programs.
- 49:24So, you know, if you find some game that's really clever, you know, you have the motivation that you want to create something cool to show off to people.
- 49:30And learn more programming to do that.
- 49:32But also if you find a really cool game, then you can just, you know, click on one button and it'll show you the source code behind that.
- 49:39And that's sort of something I had been thinking about, like, okay, I really want to create a website like that for this Minecraft robot programming book.
- 49:46And also I've been sort of thinking like, oh, maybe I could create something like that for Pygame specific games as well.
- 49:53That would be really, yeah, that'd be really fun.
- 49:55Yeah.
- 49:55You could, you could totally do that.
- 49:56A little bit of Docker, a little bit of GitHub.
- 49:58Yeah.
- 50:00Yeah.
- 50:00Yeah.
- 50:00Exactly.
- 50:01I mean, yeah.
- 50:02So, you know, and hence why I'm teaching myself like Bootstrap and a whole bunch of other web frameworks and things like that.
- 50:08Of course.
- 50:09I like Bootstrap.
- 50:10I use it for all my sites as well.
- 50:11It's great.
- 50:13All right.
- 50:13Well, so you're working on the Lua book.
- 50:16You've got the website coming.
- 50:17Like, how do people keep up with this?
- 50:19Like, how will they know when this comes out?
- 50:22Probably the best way is to probably follow me on Twitter, actually.
- 50:27But then also I have, I'm restarting, I had a blog on inventwithpython.com that I used to post little tutorials to, and I'm ramping that back up again.
- 50:37So it's, if you just go to inventwithpython.com and then click on the link to the blog, that's probably like the best way to keep up with what I'm doing.
- 50:46And I also have, oh, I also have alswigert.com, which is a really plain looking website.
- 50:53But I kept losing track of like, oh, yeah, I created this Udemy course for Automate the Boring Stuff.
- 50:58In fact, I think I forgot to mention that in this podcast.
- 51:02Yeah, yeah.
- 51:03So why don't you tell people about it?
- 51:04Because you do have a pretty popular course on Udemy, right?
- 51:08Yeah.
- 51:08Around your book.
- 51:09Yeah.
- 51:10So this was like shortly after Automate the Boring Stuff came out.
- 51:14And I kept thinking of like, how can I help promote this book?
- 51:16And so I found Udemy.com.
- 51:19So there's a lot of these websites online that have video courses, but most of them you have to be affiliated with a university.
- 51:27I think like Coursera or edX, you have to be a professor, essentially.
- 51:30Udemy.com has courses that can be created by anybody.
- 51:34And so, of course, you know, it does have sort of like a lot of really low quality courses on it.
- 51:39But I thought like, well, okay, I can try this out.
- 51:42And so I started making screencast tutorials, basically following along with Automate the Boring Stuff.
- 51:47And that course actually sort of is the other half of my income.
- 51:52I mean, it's sort of making as much as Automate the Boring Stuff the book.
- 51:56And I'm really just blown away by, you know, like, well, okay, I can actually, you know, it wasn't entirely dumb to quit your job as a software developer and enter the lucrative world of, you know, books.
- 52:09Yeah, I think the trick or the thing you got right is you've got the book, you've got the website, you've got the course.
- 52:16It's like you sort of got a package around it.
- 52:19It's not just like, oh, here's a book I did.
- 52:20Go forth and like live in the world book.
- 52:23You've got the promotional angles and the different stuff going.
- 52:26Yeah.
- 52:26Yeah.
- 52:26Yeah.
- 52:26I try to just create a whole bunch of things that sort of support each other.
- 52:29And, you know, and of course, all of this is just only possible because so many people in the Python community are so excellent about spending their time and skills making Python even better and just building the community.
- 52:42It's something that I really haven't seen anything close in other programming communities.
- 52:46So the Python and also PyCon, the Python conference, they just blow my mind.
- 52:53It's really great.
- 52:54Yeah.
- 52:54I definitely second that.
- 52:55And for people who don't have your PyCon ticket yet, better hurry.
- 52:59It's going to be sold out and you're going to be sad, right?
- 53:01I have a booth there with the podcast booth.
- 53:04And are you going to be there?
- 53:06Oh, yeah, definitely.
- 53:07Definitely.
- 53:08Yeah.
- 53:09It's not that far from San Francisco to Portland, right?
- 53:11Oh, yeah.
- 53:12Not at all.
- 53:12In fact, last year it was also in Portland.
- 53:15They do it in the same city for two years before switching.
- 53:17And I went up with a bunch of people on Amtrak.
- 53:20So there was a group of people starting in San Jose, making their way up the coast, taking a train to PyCon.
- 53:27So that was a lot of fun, just hanging out with conference goers beforehand.
- 53:31I think it was called PyCon on a train or something like that, or Pythons on a train.
- 53:37But yeah, you can probably, if you're interested in finding out about that, you can probably Google for that.
- 53:43Oh, that's awesome.
- 53:44It's about a 15-minute drive from my house to PyCon this year.
- 53:47So no trains for me.
- 53:48Oh, right.
- 53:48Yes.
- 53:49But maybe sometime soon I'll get a chance, although probably not to Ohio next year.
- 53:54Right, right.
- 53:54But definitely, if you guys are interested in going to PyCon and want to do a selfie with Al,
- 54:01you've got to get yourself there.
- 54:02All right, man, that's awesome.
- 54:05So it sounds like you have a lot of cool stuff brewing.
- 54:07And this book is really interesting.
- 54:09And thanks for chatting through it with me.
- 54:11Yeah, thanks for having me.
- 54:12You bet.
- 54:12Before I let you out here, two more questions.
- 54:14We just passed over 100,000 packages on PyPI.
- 54:18What one of those few would you like to recommend that people check out they maybe don't know about?
- 54:23Well, if I want to be totally selfish, PyAutoGUI, because it's a package that I wrote.
- 54:29It's a GUI automation package where essentially you can have your Python scripts control the keyboard and mouse.
- 54:35So if you just have some task where you need to like click on something over and over again or just like automatically fill out a form and type something for you, you can use this to essentially sort of like simulate having an intern type and click for you.
- 54:49But I think really I'm really impressed by the requests module.
- 54:54So requests is a really simple to use sort of version of what URL lib in the Python standard library does for making HTTP requests.
- 55:04Except requests just makes it so easy to just download files or access websites.
- 55:10And I'm just really impressed by it.
- 55:13And so I highly recommend that.
- 55:14Yeah, I definitely second that.
- 55:15It's a very, very nice one.
- 55:16Awesome.
- 55:17And favorite editor, Idle?
- 55:19I mean, these days I'm mostly using Sublime Text.
- 55:22So I've kind of gone the text editor route rather than having like a full-blown IDE.
- 55:27So yeah, I think I would go with Sublime Text.
- 55:30But, you know, I guess Idle technically counts as an IDE.
- 55:33So I would say my favorite IDE is Idle.
- 55:35Oh, right on.
- 55:37All right.
- 55:37So it's been great to chat with you about this.
- 55:40Final call to action.
- 55:41What should people do to learn more about what you're up to?
- 55:45Oh, well, I guess like alswigert.com has just links to,
- 55:49everything I've done.
- 55:50But really, like as far as a call to action, definitely get involved with your local Python
- 55:55community.
- 55:55If you live in a large city, there's bound to be like a meetup.com group for Python.
- 56:01Or definitely think about heading out to PyCon, even if you're still a beginner in Python
- 56:05or, you know, you're not yet a professional software developer.
- 56:08It's such a great and welcoming community that I really recommend it for a lot of people.
- 56:12All right.
- 56:13I totally agree.
- 56:13Great recommendation.
- 56:14Al, thanks for being on the show.
- 56:16Chat with you later.
- 56:17Yeah.
- 56:17Take care.
- 56:18Bye.
- 56:19This has been another episode of Talk Python To Me.
- 56:22Today's guest has been Al Swigert.
- 56:24And this episode has been sponsored by Intel and GetStream.
- 56:27The Intel distribution for Python delivers the high-performance Intel C libraries built right
- 56:33into Python.
- 56:33Get close to 100 times better performance for certain functions when using NumPy, SciPy, and
- 56:39scikit-learn.
- 56:39Check them out at talkpython.fm/intel.
- 56:43If you're building an app with a feed, make sure to check out GetStream at talkpython.fm
- 56:48slash stream.
- 56:49They have the intelligent, scalable, and tested feed API you need to be one step closer to
- 56:54launching your app.
- 56:55Are you or your colleagues trying to learn Python?
- 56:59Well, be sure to visit training.talkpython.fm.
- 57:02We now have year-long course bundles and a couple of new classes released just this week.
- 57:07Have a look around.
- 57:08I'm sure you'll find a class you'll enjoy.
- 57:10Be sure to subscribe to the show.
- 57:12Open your favorite podcatcher and search for Python.
- 57:14We should be right at the top.
- 57:16You can also find the iTunes feed at /itunes, Google Play feed at /play, and
- 57:21direct RSS feed at /rss on talkpython.fm.
- 57:25Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.
- 57:30Corey just recently started selling his tracks on iTunes, so I recommend you check it out at
- 57:35talkpython.fm/music.
- 57:37You can browse his tracks he has for sale on iTunes and listen to the full-length version of the
- 57:42theme song.
- 57:42This is your host, Michael Kennedy.
- 57:44Thanks so much for listening.
- 57:46I really appreciate it.
- 57:47Smix, let's get out of here.
- 57:49Smix, let's get out of here.
- 57:49spinner preview,
- 57:57back to who rocked the best.
- 57:59I'm first developers.
- 58:01I'm first developers.
- 58:08Developers, developers, developers, developers, developers.
- 58:11you
- 58:11you