Latest / Talk Python To Me / #12: Deep Dive into Modules and Packages
Transcript
- 0:00Quick, what's the difference between a module, a package, and packaging in Python?
- 0:05Okay, maybe you should listen to this episode of Talk Python To Me,
- 0:08number 12 with David Beasley.
- 0:10It's all about packages, and it was recorded Monday, May 27, 2015.
- 0:15Hello, and welcome to Talk Python To Me,
- 0:43a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.
- 0:49This is your host, Michael Kennedy.
- 0:51Follow me on Twitter, where I'm @mkennedy,
- 0:53and keep up with the show and listen to past episodes at talkpythontome.com.
- 0:58This episode, we'll be talking to David Beasley about the internals of modules and packages in Python.
- 1:05I'm thrilled to tell you that this episode is brought to you by Codeship.
- 1:09Codeship is a platform for continuous integration and continuous delivery,
- 1:13as a service.
- 1:14I'll talk more about them later in the show.
- 1:16Please take a moment to check them out at codeship.com,
- 1:20or follow them on Twitter, where they're at Codeship.
- 1:23This episode is also brought to you by Hired.
- 1:26Hired has joined Talk Python as a sponsor because they want to help you find your dream job.
- 1:30Hired is built specifically for developers looking for new opportunities.
- 1:34You can sign up and expect to get five offers within the first week,
- 1:39and salary and equity presented right up front.
- 1:42Check them out and get a very special offer at Hired.com slash Talk Python To Me.
- 1:47Think them on Twitter, where they're at Hired underscore HQ.
- 1:51The last show on Computer Vision with Adrian Rosebrock, that was show number 11,
- 1:56we talked about a laptop sticker from years back, which really inspired him.
- 2:00It said, Python will save the world.
- 2:03I don't know how, but it will.
- 2:04Well, I thought that was a great sticker, and I tracked down a picture of it for you.
- 2:08Check it out at bit.ly slash Python save.
- 2:11I invited David to come on the show and talk about this subject after watching his tutorial
- 2:17online at PyCon 2015.
- 2:19Remember, I have this list of my essential 30 presentations from PyCon 2015,
- 2:25and of course, David's is on it.
- 2:27Check it out at bit.ly slash PyCon 2015 MK.
- 2:32Now, let's get to the interview.
- 2:34Let me introduce David.
- 2:37David Beasley is an independent software developer, teacher, and book author living in Chicago.
- 2:42He primarily works on programming tools and teaches programming courses for software developers,
- 2:47scientists, and engineers.
- 2:48He's the author of the Python Essential Reference and Python Cookbook.
- 2:53David, welcome to the show.
- 2:55Hi, how are you?
- 2:57I'm doing fantastic.
- 2:58Thank you for being on the show.
- 2:59I'm really glad to have you here.
- 3:01Okay, thanks for having me.
- 3:02Yeah, you bet.
- 3:03I saw your packages and modules talk at PyCon 2015, and I thought it was really interesting.
- 3:10Okay, you survived that.
- 3:12I did survive.
- 3:13Unfortunately, my wife was traveling, and we have small kids, so I saw it remotely over YouTube.
- 3:18But I wish I was able to be there.
- 3:21So I sort of saw it.
- 3:23But yeah, it was really, really interesting.
- 3:25You didn't put it on for the kids?
- 3:26Oh, my kids love it when I put on Python instructional videos for them.
- 3:30Yeah, they're like, Dora the Explorer, forget it.
- 3:32Give me something to do with, like, async Python.
- 3:36I'll do that.
- 3:37Yeah, yeah.
- 3:38Good.
- 3:39So we're going to talk a lot about packages and other stuff that you've got going on as well.
- 3:43But let's start at the beginning.
- 3:45Where did you get started in programming and Python and all that stuff?
- 3:50So I got started, it's hard for me to believe, but about 19 years ago with Python.
- 3:55I was actually using it in the context of scientific computing.
- 4:00So around that time, I was trying to figure out some way to script scientific software written in C.
- 4:05And kind of, for lack of a better description, was trying to create my own version of MATLAB, actually.
- 4:11So...
- 4:12What kind of science was it?
- 4:13Well, I was doing molecular dynamics, material science, sort of on supercomputers and had done a lot of C programming for that.
- 4:21And, you know, kind of the biggest problem that we had in that project was not the scientific computing part of it, but it was everything else.
- 4:29Like just moving files around and, like, ripping data formats apart.
- 4:34Kind of like all the annoying day-to-day stuff.
- 4:37And so I was looking for some way to kind of solve that problem.
- 4:41Prior to discovering Python, I had actually written my own scripting language, for which I was sort of resoundingly flamed at graduate school.
- 4:50They were sort of saying, Dave, like, why are you making your own programming language?
- 4:54Why don't you just use Tickle or some, you know, some existing thing?
- 4:58And then I had read about Python in a, I think, an article in Computers and Physics or something like that.
- 5:04And just said, oh, I'm going to go check that out.
- 5:07Yeah.
- 5:07And you're like, hey, somebody else wrote a scripting language.
- 5:10Look at that.
- 5:10Yeah, it is way better than mine.
- 5:12You know, the syntax was fairly similar.
- 5:15So...
- 5:15Did yours have white space?
- 5:16Like significant white space?
- 5:18I did not have significant white space.
- 5:20But I didn't have dollar signs and other kind of, you know, crazy things either.
- 5:24So it was...
- 5:25Okay, so you started out in the scientific world.
- 5:27And, you know, I think Python now is super big for scientific programming.
- 5:32How was it back then?
- 5:33Back then, it was pretty radical.
- 5:35I mean, this was like 96.
- 5:38And if you go back that far, there were basically no tools available.
- 5:43I mean, or it's very minimal tools.
- 5:45And then a lot of the...
- 5:46A lot of what you faced was pushback.
- 5:49Because people thought, well, you know, can't write real software in a scripting language.
- 5:55You know, why are you fooling around with this scripting language?
- 5:58This thing.
- 5:59Instead of coding in C++.
- 6:01Right.
- 6:01Especially if it's computational, right?
- 6:03Yeah.
- 6:04I mean, I actually got quite a bit of negative response.
- 6:08Because I was running interactive Python on a supercomputer.
- 6:11And people were like, you're just burning up, like, hundreds of dollars of CPU cycles just typing at the keyboard at this prompt.
- 6:20You know, like, what are you doing?
- 6:22And they didn't really realize that doing that was actually saving us huge amounts of time later.
- 6:28You know, like, preventing us from running bad simulations or taking problems that used to take, you know, like, 50 hours and reducing it down to 15 minutes.
- 6:37That kind of stuff.
- 6:39But, yeah, it was a lot of pushback.
- 6:41That's really funny.
- 6:42It's interesting how people can focus on the wrong things.
- 6:45You know, like, oh, we've got to have another server for that.
- 6:47Or, you know, otherwise we'd have to have another person.
- 6:50Or something like this, right?
- 6:51I actually got quite a few people sort of mad in talks.
- 6:56I gave some talks about this, and every now and then I'd get a, you know, like a question, like, how did you get permission from management to do this project?
- 7:03And I would just say, well, we didn't ask.
- 7:06They didn't explicitly forbid it, so it's permitted.
- 7:09Yeah, so it was very much kind of a, you know, I don't know whether hidden project.
- 7:15It was not really an approved project.
- 7:17Yeah, a guerrilla project, maybe.
- 7:18Project.
- 7:19Although, you know, the people involved, I mean, at the time I was, you know, I was doing this work in Los Alamos.
- 7:24You know, there was a group in Livermore National Lab kind of doing the same things.
- 7:29And a lot of that early work is sort of led to kind of the precursors of things like NumPy and the SciPy tools that people are using now.
- 7:37So, yeah.
- 7:38Think of how the world would have been different if you had that to start from, right?
- 7:43It would have made a big difference for you guys, I'm sure.
- 7:45You've got to start somewhere, I guess.
- 7:47Somebody has to shake things up, I guess.
- 7:51Yeah, well, that's really cool.
- 7:53What are you doing today with Python?
- 7:54So, right now, well, a variety of things.
- 7:58I'm teaching classes.
- 7:59I'm also involved with a startup company.
- 8:02That's been a little bit secretive.
- 8:03But I'm technically co-founder of a startup doing some education tech stuff.
- 8:09And I'm actually coding with that.
- 8:12I'm doing a lot of just back-end web programming, databases, SQLAlchemy, things like that.
- 8:19I'm supposed to be working on a new version of the Python Essential Reference book.
- 8:24I haven't really started that yet.
- 8:27I hope my editor doesn't listen to this.
- 8:29But, you know, that's coming soon as well.
- 8:32Well, we'll make it up to him by promoting the book in the show notes or something like that.
- 8:38How's that?
- 8:38Right, right.
- 8:39Yeah, the tech education scene is insanely hot right now.
- 8:43And VC and people, it's really an amazing place to be.
- 8:47And I'm doing a little bit of stuff there as well.
- 8:49And just, you know, knowing what's going on there is just amazing right now.
- 8:52Yeah, a lot of crazy, crazy things there.
- 8:55I guess if it wasn't crazy, it wouldn't be, I don't know, it wouldn't be worth doing, I guess.
- 8:59Exactly.
- 8:59It'd be like going back to high school instead.
- 9:01Right, right.
- 9:01Yeah.
- 9:09CodeChip is a hosted continuous delivery service focused on speed, security, and customizability.
- 9:16You can set up continuous integration in a matter of seconds and automatically deploy when your tests have passed.
- 9:21CodeChip supports your GitHub and Bitbucket projects.
- 9:25You can get started with CodeChip's free plan today.
- 9:27Should you decide to go with a premium plan, Talk Python listeners can save 20% off any plan for the next three months by using the code TALKPython.
- 9:36All caps, no spaces.
- 9:38Check them out at CodeChip.com and tell them thanks for sponsoring the show on Twitter where they're at CodeChip.
- 9:45Awesome.
- 9:53So what inspired you to do a tutorial on packages?
- 9:56I mean, that seems like, you know, doing a tutorial on for loops or something.
- 10:01But obviously, you know, it was a two, three hour tutorial and it was really great, I thought.
- 10:06So, but, but what started you on this path?
- 10:09Yeah.
- 10:09A three hour tutorial on packages.
- 10:11Import.
- 10:12Okay.
- 10:13Now you can just contemplate this for two and a half hours to get the zen of it, right?
- 10:17Yeah.
- 10:17So I guess it was like probably a, so packages, I mean, modules and packages.
- 10:22I mean, one part of it, it's something that, that I've rarely thought about.
- 10:26You know, it's like you learn Python, you know, 19 years ago.
- 10:29I was like, yeah, there's the import statement.
- 10:31And yeah, sometimes you have to fiddle with the system path and, and, and, and, and so forth.
- 10:36You know, you sort of, you sort of get over it.
- 10:39But in, you know, in teaching a lot of classes and working with other people, it seems like
- 10:45the import statement is like this no end of just hell for people.
- 10:49Like, you know, I'll be teaching a class somewhere and then, you know, kind of walk around and I'll
- 10:54see somebody struggling.
- 10:55And they're like, yeah, I've been fooling around with this for like half an hour or something.
- 10:59And first, first of all, like, why didn't you get my attention earlier?
- 11:02But then you, but then you go over there and you realize that they're just fiddling around with
- 11:05some stupid thing with the import statement.
- 11:07Like, you know, the file is named wrong or that it's in the wrong directory or they're trying to
- 11:12reload something or.
- 11:13It could be subtle as well.
- 11:16It's like, you might have a number as the starting name for your directory or something like that.
- 11:19Right.
- 11:20Yeah.
- 11:20Subtle things or, you know, or like, you know, you're working with people on a project, you know,
- 11:25it's like four o'clock in the afternoon and somebody's like, why are they cursing so much
- 11:28over there?
- 11:29You know, I go walk over, walk over there and they're like cursing about like why Python isn't
- 11:33running their code correctly only to, only to realize that they, they've forgotten that
- 11:38module loading.
- 11:39It's a one-time operation.
- 11:40Right.
- 11:41Exactly.
- 11:41It's not reloading there.
- 11:43I changed it, but it's not changing.
- 11:45Loading.
- 11:46So, so, so part of it was just, it's like, I should do something on modules and packages to
- 11:51try and like, I don't know, clear confusion maybe.
- 11:54But I think, I think also part of it is the whole module system in Python has,
- 11:59has been basically rewritten.
- 12:01I don't know whether it's like a, it's almost like a from scratch rewrite where all of the
- 12:05mechanics of it have actually been pulled out of C and put up into the Python level.
- 12:11So almost, almost all the internals of modules and imports and packages and stuff is, is sort
- 12:16of way more accessible now.
- 12:19And so I thought it'd be kind of, kind of interesting to, to, to look at that as well,
- 12:23just sort of take like a totally modern take on it and just see, you know, like what's going
- 12:29on with modules and packages.
- 12:30Yeah.
- 12:31Before we get into the details, I, I'm sure everybody kind of gets a sense of what are modules,
- 12:36what are packages, but just to make sure we're all on the same page, I could import things.
- 12:41And sometimes I import a module and sometime I'm importing a package.
- 12:45What's the deal there?
- 12:46Well, I mean, a module, you know, maybe a simple view of it is, you know, people think of it
- 12:51as like a single file, you know, single, single, file of source code, package would
- 12:57be more of a collection of files.
- 12:59You know, maybe larger application or a framework or, or, or something like that.
- 13:05I think one thing that can be a little bit muddled is sometimes things look like modules
- 13:09when in fact they're big packages and, you know, it can be kind of muddled sometimes.
- 13:16So it seems to me like with modules, I'm getting just a file, right?
- 13:19Like, Hey, I've written some code over here.
- 13:21I've written some code over there.
- 13:22Let me grab the code in the one file and use it.
- 13:25And with packages, it seems like there's a lot more going on potentially, right?
- 13:31I've got the under, under init.py and I can sort of declare this all under, under all
- 13:37variable.
- 13:38Can you maybe talk a little bit about the structure of a package and why you might build one?
- 13:43Okay.
- 13:43Well, I think, you know, the, so, so one thing with packages is, well, let me, let me back
- 13:49up for a second here.
- 13:50I think like, like if you're thinking about module, typically you're thinking about something
- 13:54kind of small, like a single file, maybe a small library, you know, maybe, maybe not a
- 14:00huge amount of functionality, but you know, it's just like a, you know, like just a single
- 14:04point of, of, of code that, that is very easy to use.
- 14:08I think with a package, you're getting into something much more complicated, you know, it's
- 14:12like much larger code base.
- 14:14And part of what you, what you want to avoid is just putting all of your code in one file.
- 14:19Like nobody wants to have a file where it's 50,000 lines of Python code in there.
- 14:23Especially not if you inherit that file.
- 14:26Yeah.
- 14:26Well, yeah.
- 14:26So especially if it's given to you.
- 14:28So with a, you know, with a package, you're really thinking about kind of breaking up your
- 14:31code into different, you know, different sub modules, different parts of the application
- 14:36and so forth.
- 14:36It's more of an organizational, you know, organizational tool than, than anything.
- 14:41Also, also just keeping your code separate from the, from the rest of the Python universe,
- 14:46you know, avoiding like naming clashes with other bits of, bits of code.
- 14:51I think the thing that gets complicated with a package is once you do that, you know, once
- 14:56you separate your code out into multiple files, you have to start worrying about all sorts of
- 15:02side issues.
- 15:03Like, like how do those files interact with each other?
- 15:06You know, like how does one sub module refer to another sub module or how do they, you know,
- 15:10combine pieces together and, and so forth.
- 15:14And that's actually where a lot of the, I think a lot of the tricky parts of packages come into
- 15:17play is that just, you know, relationships within the package causes a lot of complexity that
- 15:23you wouldn't see with a single, you know, a single file module.
- 15:27Right.
- 15:27I totally agree.
- 15:28There's a lot of stuff you can do in that init file to sort of make it explicit about
- 15:34what you want to export.
- 15:35And I think of these packages as like reusable libraries that you're going to grab and they
- 15:40have a bunch of functionality.
- 15:41Whereas modules, I kind of feel like, Hey, I'm just, I'm reusing a file that I wrote.
- 15:44This file wants access to that part of my code.
- 15:46So I pull that in.
- 15:47And so you talked about a lot of cool tips and tricks that you can kind of do there.
- 15:53You talked about like the all, all variable.
- 15:56You talked about importing sub modules in the main level module and stuff like that.
- 16:02Yeah.
- 16:02I think one of the, one of the things that, it might be more of a personal complaint,
- 16:06but you know, when you use packages a lot, you can sometimes get a pull, like a huge number
- 16:11of imports that start showing up in your code where, you know, instead of just importing a
- 16:16single file, all of a sudden you're, you're putting in like 20 import statements and not a,
- 16:22I'm not a huge fan of doing that.
- 16:24So, you know, these are knit files that you sometimes see in packages.
- 16:27I mean, those, one, one use of those is, is to basically coalesce the pieces into one
- 16:33place.
- 16:34And, you know, sometimes you can cut down on the number of imports that you have to do.
- 16:38Right.
- 16:39Maybe you import the top level thing, like import SQLAlchemy.
- 16:43And then you could say SQLAlchemy dot and get to the sub packages, something like that.
- 16:47Right.
- 16:47Right.
- 16:48Right.
- 16:48You don't have to worry about, you know, how they organize that under the covers of SQLAlchemy.
- 16:53It could be, you know, spread across, you know, 20 different files for all you care.
- 16:56Yeah, exactly.
- 16:58But you have to manually do that in the init file, right?
- 17:00In order to sort of force the top level import to bring in the sub packages.
- 17:04Is that correct?
- 17:04You, you have to take some steps there.
- 17:07Yeah.
- 17:07I mean, it's, you know, if you're the author of a package, you have to figure out
- 17:10some way to, some way to do that.
- 17:12I've done some tricks involving decorators doing that.
- 17:16Like, you know, they, being one of the applications I'm working on now, I mean, I
- 17:21have a, I have a decorator I can put on functions that will automatically sort of hoist them up
- 17:27into the init file.
- 17:28So, I mean, there are, there are tricks that you can do to, to, to do that kind of thing.
- 17:33That's really cool.
- 17:34Is that a decorator that you wrote?
- 17:35I just cooked it up myself.
- 17:37Yeah.
- 17:37Is it on GitHub or something?
- 17:38It's, I don't know if it's on GitHub.
- 17:41it is in the tutorial though.
- 17:43Right.
- 17:44Okay.
- 17:44A module.
- 17:45It's somewhere in that tutorial.
- 17:46So.
- 17:46Nice.
- 17:47one thing that I thought was interesting that you spoke about the tutorial was that
- 17:52structure guidelines, the PEP 8 guidelines sometimes make your code more brittle in packages
- 17:57than otherwise should be.
- 17:58Oh yeah.
- 18:01Yes.
- 18:01One of the things with PEP 8, I think is it predates some of the work that went on in
- 18:06packages.
- 18:07I mean, you know, like, like PEP 8 sort of talks that you should, you know, well, it
- 18:11sort of says things like, oh, you should just do like an absolute import from kind of a top
- 18:16level package name.
- 18:18So if we were writing like the, the, a package called math and it had a, a class called library,
- 18:24uh, calculator, something like that, we might in the init file say import math dot calculator
- 18:30where math is the actual name of the package.
- 18:32Right.
- 18:33I don't know that I'd use math as the best.
- 18:35Okay.
- 18:36Yeah.
- 18:36So I'm lacking creativity.
- 18:38Yeah.
- 18:38Pick another example.
- 18:39Yeah.
- 18:39I, it's, it's more concerning things like imports within the package.
- 18:43Like if you, you know, if you had a package where, you know, you had a, like there was a
- 18:48sub module called graphics and there was another module called data or something like that.
- 18:53You would end up importing from the top level name down.
- 18:57So if you're, if your package was named spam, for instance, you'd have to say, you know, import
- 19:01spam dot graphics or import spam dot data.
- 19:04And you would, you would do that within the package, within the package itself.
- 19:10but the thing that I don't, that I don't like about that is it ends up hard coding the
- 19:14package name.
- 19:15Right.
- 19:16For example, if you rename the package, what happens?
- 19:18Well, then you have to go change all of your code.
- 19:20Great.
- 19:22See, that's the part I don't like.
- 19:23Is there a fix?
- 19:23Well, you could use, one of the things that you can use are these package relative imports.
- 19:28This is this form.
- 19:30I, it's, I'm actually surprised how many people have not seen it sometimes, but it's, what it
- 19:35looks like is you have these dots where you would say something like, oh, from dot import
- 19:39graphics or from dot import data.
- 19:41And the dot is just telling Python that you want to load relative to your current location,
- 19:47for instance.
- 19:48Right.
- 19:49Exactly.
- 19:49So then it doesn't matter what you call the package.
- 19:52Right.
- 19:52Right.
- 19:52Right.
- 19:52That's really excellent.
- 19:53I'm sort of thinking about things like versioning and stuff.
- 19:56I mean, it's, you know, I could imagine situations where, you know, I have code where I need
- 20:01to have an old version of some package coexisting with a modern version of the same package.
- 20:06You know, one of the ways that you could deal with that is just to rename the old one.
- 20:11Right.
- 20:12Exactly.
- 20:13Exactly.
- 20:13Graphics dot, graphics dot old or underscore old or something like that.
- 20:16Right.
- 20:17Right.
- 20:17Right.
- 20:17As long as you don't have the package name hard coded in there, that, that, that all works
- 20:22fine.
- 20:23So.
- 20:23Yeah.
- 20:24I think it's, I think it's really good advice.
- 20:26I propose we amend PEP 8 to have the package relative imports.
- 20:31I wonder when that part was written in PEP 8.
- 20:34I mean, it's, I have to, I hate to admit this on like a podcast, but I'm sort of a flagrant
- 20:40PEP 8 violator.
- 20:42Don't worry, you, nobody can see the code, so they won't really know about it.
- 20:45It's fine.
- 20:46Yeah.
- 20:46It's, I don't mean to violate it, but I think it's, you know, PEP 8 comes after
- 20:53the point at which I got involved with Python.
- 20:55So it never really entered my consciousness of something that I would pay attention to.
- 21:00I mean, it's.
- 21:01Your style was already set by the time.
- 21:02Yes.
- 21:02Yeah.
- 21:03I haven't, I have enough trouble just with the, people are always giving me a bad time
- 21:08for using double quotes on all my strings.
- 21:11Even, you know, I think like, you know, it's, that's fine in Python, but you know, most people
- 21:15tend to use like the single quote and instead I'm kind of locked into double quotes just because
- 21:20I've done so much C programming.
- 21:21Exactly.
- 21:22The, the single quote in C doesn't do the same thing.
- 21:25I just can't get out of C programming, even though that's not my day-to-day job.
- 21:29So yeah, I have the same problem.
- 21:31I'm kind of back and forth on it.
- 21:41This episode is brought to you by hired hired.
- 21:46Hired is a two-sided curated marketplace that connects the world's knowledge workers to the
- 21:52best opportunities.
- 21:53Each offer you receive has salary and equity presented right up front, and you can view the
- 21:58offers to accept or reject them before you even talk to the company.
- 22:02Typically candidates receive five or more offers in just the first week.
- 22:06And there are no obligations ever sounds pretty awesome.
- 22:10Doesn't it?
- 22:10Well, did I mention there's a signing bonus?
- 22:12Everyone who accepts a job from hired gets a $2,000 signing bonus.
- 22:16And as talk Python listeners, it gets way sweeter.
- 22:21Use the link hired.com slash talk Python to me and hired will double the signing bonus to
- 22:27$4,000 opportunities.
- 22:30Knocking.
- 22:30Visit hired.com slash talk Python to me and answer the call.
- 22:34One thing that goes, you know, hand in hand with packages and trying these things out and
- 22:48so on is virtual environments.
- 22:50Do you use those often?
- 22:52This is going to sound really shocking, but I almost never use them.
- 22:55Okay.
- 22:56I don't know why I never use them.
- 23:00It's like I tend to, when I want to do something custom, I tend to just kind of build Python
- 23:06myself.
- 23:07And I might just put it in its own directory somewhere.
- 23:10I don't know.
- 23:12You know, that's probably just a bad thing to be doing, but maybe it's more historical.
- 23:16Just having used Python for a while, that's something that's never been that hard to do.
- 23:22Right.
- 23:22Well, you understand it well enough.
- 23:24You just do what virtual environment does more or less, right?
- 23:26Yeah.
- 23:27I do it the inefficient way, you know.
- 23:29The explicit way.
- 23:31How's that?
- 23:32The explicit way.
- 23:33You just download from source.
- 23:34Yeah.
- 23:36One of the things I do like about, well, I think is that I've actually have started using
- 23:41them a little bit more ever since they got built into Python 3.
- 23:46So that's actually a big win, I think, for sort of the newer versions of Python is they
- 23:51have the virtual environment feature kind of just baked into the language.
- 23:55I think that is really nice.
- 23:58You know, we could go into a whole side conversation on Python 2 versus Python 3.
- 24:04Yeah, we probably don't want to go there.
- 24:05We probably don't want to go there.
- 24:07But I think it's interesting that things like that are like, hey, here's a little less friction
- 24:11if you go down the Python 3 path.
- 24:13I talked with Kenneth Reitz on show number six.
- 24:15We talked a little bit about that.
- 24:17And he's like, I think what we really need is a killer feature that only appears in Python
- 24:223 in order to get people really to switch.
- 24:24I mean, there's small gains that are making around like Django switching their documentation
- 24:29by default to Python 3.
- 24:30And that made a measurable dent in the world.
- 24:34But, you know, things like maybe in Python 3, there's no such thing as a global interpreter
- 24:39lock.
- 24:40Well, that would be a big win.
- 24:42I don't know whether that's going to happen anytime soon.
- 24:45Of course.
- 24:45You know, possibly with something like PyPy, right?
- 24:48Or Pyston.
- 24:48Maybe.
- 24:49I don't know.
- 24:50Yeah, maybe.
- 24:50Anyway, you know, I think it's interesting.
- 24:52But yeah, so these things like the virtual environment stuff being built into Python 3,
- 24:57it's really cool.
- 24:58And it's, you know, one more check in the box of, hey, you know, consider Python 3.
- 25:01So another thing that you talked about is like splitting modules into a bunch of multiple files.
- 25:08And I really like to do this.
- 25:10Like you sort of started out the conversation.
- 25:12I really, really dislike large files, right?
- 25:16I would much rather have 10 50 line files than one 500 line file or two 250 line, you know,
- 25:24whatever the math works out to be.
- 25:25It's a bunch of smaller files.
- 25:27It seems like Python kind of dislikes me doing this.
- 25:30You know, it's the more I break stuff into small files, the more I have to put a whole bunch of imports at the top.
- 25:39Right.
- 25:39And that's that that is one thing.
- 25:40I mean, you can definitely solve that with those init file.
- 25:43I mean, if you put it all in a package, you can kind of stitch it all back together in a knit.
- 25:48Right.
- 25:49So I could have like all those in a subfolder, which has an under under init.
- 25:53So it's a sub package.
- 25:55And in that under under init, I would have like import and say from my class import my class or whatever.
- 26:04And then they would sort of drop into that top level namespace.
- 26:07Right.
- 26:08Right.
- 26:08Right.
- 26:08Right.
- 26:09So there's actually quite a few things in the standard library that do that already.
- 26:13You know, like things like I think the collections module does that.
- 26:17Multiprocessing does that.
- 26:19I mean, if you if you look at how those are implemented, they're actually collections of files.
- 26:23But to kind of an end user from kind of the Python side, it just looks like you're using a single module, basically.
- 26:30Yeah, exactly.
- 26:31Just collections dot.
- 26:32And it's all there.
- 26:33So they pull that off with the package stuff.
- 26:36Right.
- 26:36With the init file.
- 26:36Yeah.
- 26:37OK.
- 26:38That's cool.
- 26:39So one thing that you talked about that I don't know very little bit about are import hooks.
- 26:43What are the stories with import hooks?
- 26:44What can I do with those?
- 26:45Well, import hooks.
- 26:49I mean, essentially, some of the new machinery with import gives you complete control over like locating modules on the system.
- 26:58What happens when you load modules?
- 27:02You can actually completely customize what happens at import.
- 27:06You know, for instance, pulling you could pull modules off of URLs.
- 27:10You could pull modules out of a database.
- 27:12You could even pull in code that wasn't Python.
- 27:15You know, one of some things I did a tutorial maybe three.
- 27:19It was three years ago, two years ago.
- 27:21I don't know.
- 27:21It was a Python three metaprogramming tutorial.
- 27:25At the end of that, I had some import hook that loaded an XML file and translated it to Python class definitions at import time.
- 27:37So I'm not saying this was a good idea.
- 27:40It was sort of an example of some crazy thing that was possible.
- 27:46That's pretty awesome.
- 27:47Maybe not recommended, though.
- 27:48Maybe not.
- 27:49Let me rephrase.
- 27:51It's probably awesome that you can do it, but not awesome if you do do it.
- 27:55Yeah, I think I pitched the XML example as something that's been very enterprise ready.
- 28:00Oh, that definitely sounds enterprise ready.
- 28:03Yeah.
- 28:04So what about threading?
- 28:06Is there any special considerations for modules if I'm like working with threads?
- 28:11Well, one of the things that I didn't realize doing the tutorial is just how nasty the import statement combined with threads is under the cover.
- 28:20Well, under the covers.
- 28:23It turns out that module imports is not really a totally thread-safe thing to do.
- 28:31Like, you know, if you're loading a module or Python is in the process of importing something, potentially you could have another thread that tries to import the same module at the same time.
- 28:42And it actually has to take some steps to avoid just complete chaos with that.
- 28:47Like, one of the things that you don't want is you don't want it to – you don't want Python to load a module twice.
- 28:55Like, you wouldn't want – because that violates the way that modules work, that they only get loaded once.
- 29:00So if you had two threads trying to import the same module, one of them has to do it and the other one has to wait.
- 29:05The other thing that's tricky is, you know, that the thread that has to wait can't use like a half-loaded module either.
- 29:14So it turns out there's a bunch of just nasty stuff with threads and import.
- 29:20I think a lot of that comes from code that does import statements inside functions.
- 29:26Yeah, yeah.
- 29:27That's kind of a temporary import it, throw it away sort of thing, right?
- 29:30Yeah, right.
- 29:31And so sometimes people will put like an import inside of a function.
- 29:34And then if that function happens to execute within a thread, you know, the import might not happen until some thread hits that function.
- 29:43And then all of a sudden you have concurrent imports taking place.
- 29:48Yeah, that doesn't sound good.
- 29:50So does Python take care of it for us though in the end?
- 29:53Python takes care of it for us, thankfully.
- 29:57But some of the code for that is really nasty.
- 29:59I looked at some of the implementation and they're doing all sorts of things like thread deadlock avoidance algorithms.
- 30:05And there's like all sorts of corner cases.
- 30:08I tried to actually get Python to fail with some of the cases that they checked for.
- 30:14I was not successful in doing that, which I think gives me maybe some bit of relief thinking,
- 30:20wow, okay, if I can't make it fail there, then it's unlikely this would happen in most code.
- 30:27But yeah, there's a lot of just really weird, nasty corner cases on that.
- 30:33Yeah, the whole threading story in Python looks a little shadowy.
- 30:37Like it doesn't get exposed to the light nearly as much as a lot of the other pieces.
- 30:40Not shadowy and necessarily evil, but, you know, it's just less used, I would guess.
- 30:45Yes.
- 30:46Well, especially if it interacts with something like import.
- 30:49I mean, you know, already import is pretty dark magic.
- 30:52And, you know, you combine that with threads and then you're sort of in a weird place at that point.
- 30:58So.
- 30:58Yes, you are.
- 30:59So you also said that you can reload modules programmatically.
- 31:03And Python doesn't do that for you, but you can.
- 31:06But you also said it's not a super good idea.
- 31:09What's the story of that?
- 31:10I would not do that.
- 31:12I mean, so Python has traditionally had this reload statement.
- 31:17You know, Python 2, you have to reload thing that would reload a module.
- 31:20And then there's always been this kind of like advice surrounding it.
- 31:25Like, well, you can do it, but you should basically never do it because, you know, puppies will die or something.
- 31:30If you do that, then there's, you know, some kind of vague, ominous sort of mystery surrounding that.
- 31:35And then in Python 3, they just took it out altogether as a built in.
- 31:40They sort of said, well, OK, we're going to get rid of reloading.
- 31:43Although you can find it in one of the libraries.
- 31:45So I think it's an import lib or something like that.
- 31:50The thing that I think is kind of interesting about reload is it's one of these things that somebody, they could think that it might be an interesting idea.
- 31:58Like, OK, I have some Python code running in a server somewhere.
- 32:02And I want to, I don't know, I want to make a code change and then, you know, have it load up into my server without restarting it or something like that.
- 32:13Yeah, maybe I've got a website sitting there running and I don't want to have to deal with it.
- 32:16I want to just notice if a new file gets dropped in here, just pick it up and run with it, right?
- 32:20Right, right, right.
- 32:21You know, maybe, you know, maybe somebody has seen, you know, like a demo of Erlang somewhere, somewhere at some place.
- 32:27And they're like, oh, I want to be able to do that in Python, you know, do like a hot swap of code or something on the fly.
- 32:33And, you know, so in the tutorial, talked about reload a little bit.
- 32:38Is there anything that you could do to make that work?
- 32:42I mean, so here's some of the problems with reload.
- 32:46One big problem with it concerns instances of objects that you've created.
- 32:51So let's say you had some code.
- 32:53You have a bunch of instances of classes kind of floating around.
- 32:57If you reload all of the class definitions, what ends up happening is you have all these existing instances that are basically using the old code.
- 33:06And then any new instance you would make would end up using the new code.
- 33:10So you could actually end up with like instances in your code using two different class definitions at the same time.
- 33:16Oh, that's kind of crazy.
- 33:17I suspect it runs, but things like static class level data might be kind of broken.
- 33:23Static stuff breaks.
- 33:24Another thing that breaks horribly is the super call.
- 33:28If you ever use that.
- 33:29One of the arguments to super is the name is the class that you're that you're working with.
- 33:35If you ever if you ever do that, you'll end up getting this extremely cryptic error message.
- 33:43Something about kittens.
- 33:44Yeah, about kittens dying or something like that.
- 33:47Although, I mean, here's here's kind of the wild thing.
- 33:50You actually can kind of hack this.
- 33:54I mean, one of the one of the things that people.
- 33:56Well, one of the things you can do with Python objects is you can change the class attribute.
- 34:01I don't know if anybody's done that, but like all objects, they have this magic attribute class that sort of points to the class.
- 34:09You could do some reloading hacks where, you know, on a module reload, you go through all of the existing instances and then flip their class attribute to the newly loaded class.
- 34:22And then all of a sudden they'll be all of a sudden they're using the new code.
- 34:25Yeah.
- 34:25So maybe it's possible if somebody really wanted to change the standard library to support this, it maybe could be done, but maybe it's not really the best idea.
- 34:35I my gut feeling is that you could probably do it if you wanted to surround your application with these sort of like 10,000 lines of code to manage it in some kind of sane way.
- 34:47And then maybe it would work.
- 34:49It's like a qualified maybe.
- 34:51You know, maybe it would work.
- 34:52I'm just not sure it's even tractable problem to solve in the big picture, though.
- 34:59I mean, it's just.
- 35:00And maybe it's not a good idea anyway.
- 35:02You know, things with, you know, I just released a show with Docker and things like Docker and these microservices and so on.
- 35:10It probably means it's less of a big deal to restart your app.
- 35:13Yeah, that's probably my feeling, too.
- 35:15I mean, I have to admit, Mike, in the code I'm working on now, if I want to do a deployment of new code, I just kill minus nine, the old one.
- 35:25Yeah, sure.
- 35:26You know, it's it's I mean, the system actually has a sort of a like a monitor or a watchdog or something that's, you know, just watches to see whether the thing is running or not.
- 35:36If it's not, it restarts it.
- 35:37Oh, it died.
- 35:38Bring it back.
- 35:38Oh, yeah.
- 35:39So if you want to if you want to do a deployment, you just kill the old one and then it will automatically respawn itself at some point.
- 35:45So, yeah, that that works.
- 35:48Nice.
- 35:49So you talked a little bit about the reloading stuff being different in Python three.
- 35:54Is there other stuff that you're aware of, like this dramatically different from Python two to Python three?
- 35:59Like if I'm down at the package level, writing code, worrying about those things, do I have to do something to make my Python two code friendly to Python three upgrades and things like that?
- 36:09I wouldn't say there's a huge number of differences on the Python two, three side.
- 36:13You know, one thing that might impact people is you can't do a relative import within a package.
- 36:19So if you had a if you had a like a package directory spam and then you had two files in there, you know, like foo and bar dot foo dot pi bar dot pi.
- 36:30In Python two, you can one of those files like bar dot pi can just say import foo and it will find it in the same directory.
- 36:38That does not work in Python three.
- 36:41You would have to say from dot import foo or something.
- 36:45So so this relative import feature, that is one place that might break in Python two, like from two to three.
- 36:53I'm not really aware of much else, though.
- 36:56And I haven't been using three for a while.
- 36:59I haven't really noticed anything that would that would break across languages like that.
- 37:04OK, that's cool.
- 37:05So you said the from dot sort of relative import style.
- 37:09Does that also work in two?
- 37:10That also works in two.
- 37:11Yeah.
- 37:11It's just there's another syntax in two that wouldn't work in three, right?
- 37:15No, it's the same syntax in two and three, actually.
- 37:18Oh, OK.
- 37:18So the syntax works in both.
- 37:21It's just that the Python two is, you know, lets you do this relative import.
- 37:26They they've taken that away from you in Python three.
- 37:29So.
- 37:29Yeah.
- 37:29OK.
- 37:30Yeah.
- 37:30That's what I was thinking of.
- 37:31OK, cool.
- 37:32One of the things that I don't know, I wanted to ask you about was what surprised you about going through like this deep dive into this world?
- 37:39Like what do you feel like you learned from this adventure?
- 37:41I think one takeaway from looking at it is that there has been really an effort at cleaning up a lot of hacks.
- 37:50Like a lot of the features that's been that have been built into the new import machinery are actually solving problems that people have been solving with Python two for maybe 10 years or more.
- 38:00Like you'll you'll you'll see some feature in Python three where it's like, oh, this is kind of interesting.
- 38:05You know, why did they do that?
- 38:06And then you kind of chase it down through maybe, you know, descriptions through peps and and things like that.
- 38:12And you realize that, you know, the motivation for this maybe came from some thing that somebody had done in, you know, in soap or something or some big Python two package.
- 38:21And they've and they've just sort of rethought it in Python three.
- 38:25And now what's interesting is the old hack that somebody would have done in Python two is just completely unneeded at this point.
- 38:34But, you know, it's been cleaned up in a totally different way.
- 38:38That's really cool.
- 38:39It's just not a problem anymore.
- 38:40Whereas you used to have to have this kind of special knowledge to survive whatever case they were dealing with.
- 38:46Right.
- 38:46Yeah.
- 38:47I think that's actually a theme with a lot of Python three, actually, not just not just imports, but to, you know, if you look really deeply at a lot of things in Python three, they're solving problems that people have been dealing with for a long time.
- 39:02But just trying to simplify it or or or make it more sane, if you will.
- 39:07And, you know, I think that's throughout the language, actually.
- 39:10You see a lot of cleanup of stuff where it's like, well, OK, you no longer have to do this kind of weird hack because it just works.
- 39:17And in Python three, the thing that's tricky is that's just a really hard selling point.
- 39:22You know, if you're trying to convince somebody to go from Python two to three and say, well, Python three is better because it cleans up this weird hack that somebody was doing on Python two.
- 39:32And, you know, 10 years ago, that's often not a compelling story.
- 39:37Sure.
- 39:37It's hard to say.
- 39:38You know what?
- 39:38It's easier for the people writing Python three, the standard library stuff to maintain it.
- 39:44So you should use it.
- 39:45And I think, OK, I don't care about that.
- 39:46That's not my problem.
- 39:47Right.
- 39:49You know, actually, one surprising thing in the Python.
- 39:52This is a well, this is one example of some Python three stuff that I thought was surprising.
- 39:58Like right now in Python three, you can ask you can ask the import system to locate a module for you without importing it.
- 40:07Which is kind of an you say, well, that's kind of an obscure thing.
- 40:12But what's kind of interesting about that is it solves a problem that people have doing what I would call a trial import.
- 40:19You've probably seen this pattern from time to time where somebody will do a try statement and then they'll try to import a module.
- 40:26And then they'll just catch like an import error exception and then maybe take action if it doesn't exist.
- 40:32Right.
- 40:33Maybe do like some sort of polyfill or try to load the version, Python two version versus Python three or something like that.
- 40:40Right.
- 40:40Yeah.
- 40:40And it turns out there's some really weird, obscure failure modes of that.
- 40:45Like, you know, like somebody might try to import a module.
- 40:48Maybe the module exists, but it can't import some other module.
- 40:54And then you end up with like these, these like weird failure modes where you might get error messages related to the wrong thing.
- 41:01Or it might be kind of pointing you in completely the wrong direction.
- 41:04Yeah.
- 41:05You might tell the user, hey, make sure you have this package installed.
- 41:07They're like, I do have this package installed.
- 41:09Right, right, right.
- 41:10Right.
- 41:10You can get like a false message saying, hey, I wasn't able to detect your package.
- 41:13And then the users like they're looking at their directory and they're cursing because they're like, wait, it's right there.
- 41:18I'm looking at it.
- 41:19Like, why can't you find this?
- 41:21I'm going to email this guy the pip list and show him it's here.
- 41:23Yeah, right.
- 41:24And so, you know, some of the things that you can do now is it's, yeah, I guess in Python terminology, it's almost like a look before you leap kind of thing with import.
- 41:35You can go to the import system and you can say, hey, where is this module?
- 41:41Do you have this?
- 41:42And it can tell you whether it has it or not without actually importing it.
- 41:46Interesting.
- 41:47What's the code look like for that?
- 41:48It's not try import or anything, right?
- 41:51You have to import a single function and you just call it.
- 41:55It's like a function call.
- 41:56Okay.
- 41:57Yeah.
- 41:57So there's some library call you say, hey, does this thing exist?
- 42:00Show me where it is.
- 42:01Yeah.
- 42:02It actually gives you this thing known as a module spec.
- 42:05So it will actually tell you a whole bunch of information about it, like what path it's in.
- 42:09Like, is it Python source code?
- 42:11Is it C source?
- 42:12Is it C module?
- 42:13Is it a built-in?
- 42:15You know, you can actually find out a lot of information about the module without even touching, without actually loading it.
- 42:22Interesting.
- 42:22Will it tell you the version?
- 42:23I don't know whether, no, because usually the version is inside the file.
- 42:29Yeah, it's in the init.
- 42:29Okay.
- 42:30Well, that's really cool.
- 42:32You can do some interesting things with that as well.
- 42:34Doing like, I guess sort of module stand-ins, for instance.
- 42:37I don't know that this will make sense, but you can make like a, you can basically ask Python to locate a module.
- 42:43And then what you could do is make a dummy module to take its place temporarily.
- 42:48Like you could make like an empty module.
- 42:51And then you could program that to auto-load the source code when it's accessed later on.
- 42:59So if you've ever had this phenomenon, probably people have done this, where you do an import on some module, and then Python just sits there for like 30 seconds while it loads the entire universe of code behind the scenes.
- 43:13You know, you might be able to use that to kind of solve loading time issues.
- 43:17You know, setting up modules where they don't actually load until they're needed.
- 43:21You could have, you know, you could do things like that, which is kind of interesting.
- 43:24Could you do something insane like kick off another thread to import it, and maybe it'll already be loaded by the time the code needs it actually gets there?
- 43:33I hadn't thought of that, but yeah, maybe.
- 43:35That probably would be wrong.
- 43:37It is kind of insane, actually.
- 43:39Yeah, so you could do like a...
- 43:40Like a lazy load.
- 43:41A lazy...
- 43:42It would be sort of a lazy load.
- 43:44Sort of a lazy concurrent.
- 43:46Yeah, I hadn't thought of that, but yeah, that is kind of devious.
- 43:50Yeah, you could program it.
- 43:53I mean, yeah, I guess you could do that.
- 43:55Man, I'd have to...
- 43:57That would...
- 43:58I don't know.
- 43:58You might have to explain that at a code review or something like that if you sprung that on your...
- 44:03Could you just tell me why this is here?
- 44:05Who knows?
- 44:07Maybe someday Python will have a lazy import keyword.
- 44:11Probably not.
- 44:12Yeah, I'm just trying to think how that would work.
- 44:14I mean, I guess that would be...
- 44:16I think you could just kick off a thread and just do nothing but import it, right?
- 44:19And then technically, I mean, Python should manage that concurrency.
- 44:23And if you don't end up calling the function that actually needed it till later, maybe.
- 44:27I don't know.
- 44:27So in a sense, you'd be sort of lying to the user, right?
- 44:31I mean, they would...
- 44:32I'm thinking how this would be useful, like interactively, right?
- 44:35They could type the port and it would come back instantly.
- 44:38Oh, look, they made it fast.
- 44:41The person using it would think, oh, Python is awesome.
- 44:44It's so fast.
- 44:45And then not realizing that it's actually importing the universe behind the scenes, in a thread taking like 30 seconds or something.
- 44:53Exactly.
- 44:54It's probably wrong.
- 44:55A lot of things are wrong, though.
- 44:58It's true.
- 44:59Okay, I have to think about that.
- 45:00So another thing I wanted to ask you about is, you know, in the init file, it kind of felt like that is there mostly to like structure your import.
- 45:09So I'm going to say import this module, this module, this module, put them in the top level namespace and so on.
- 45:15But you can write arbitrary code there.
- 45:17Do you think that that kind of stuff is like abusing the intent of that?
- 45:22Or is it kind of, it's just taking advantage of what you should be able to do?
- 45:25I see modules that do that.
- 45:28I don't have a strong opinion on it.
- 45:31Although I have to say it kind of rubs me the wrong way a little bit to see tons and tons of code in the init file.
- 45:39Partly because that's not where I'm expecting to see it.
- 45:42If I'm looking at somebody else's code and I want to know, oh, where's the source code for the database object or something like that?
- 45:48I'm more inclined to look for maybe a file called db.py or something.
- 45:54It doesn't occur to me that the code would be in the init file.
- 45:59Yeah, I kind of feel the same way.
- 46:01I was wondering what your thoughts were there.
- 46:03I try to keep the init files kind of small.
- 46:07Yeah, I agree.
- 46:08Like I said, more small files is my style as well.
- 46:12Just sometimes, you know, I feel like I'm importing a thousand things.
- 46:16Yeah.
- 46:17I mean, I have seen that technique used.
- 46:19I mean, sometimes I run into that where, you know, maybe somebody started with just a single file module.
- 46:24And then all of a sudden they want to have unit tests shipped with it or something.
- 46:29Like maybe they want to have like a subdirectory of unit tests.
- 46:32And they'll do things like, oh, I'll just take my whole module and drop it into the init file.
- 46:37How could that be wrong?
- 46:38You know, and then I'll have like a separate test subdirectory or something where I'll put my unit tests.
- 46:44So I don't know.
- 46:46Okay, there's two questions that I like to ask my guests near the end.
- 46:52And so I'll ask you those now.
- 46:54Do you have any favorite PyPy packages or like libraries that, you know, you think are really cool?
- 47:01I just want to say, hey, world, check out this package.
- 47:03It's really awesome.
- 47:05Okay.
- 47:05Well, there are the obvious ones.
- 47:08I'm a big fan of pandas.
- 47:10Pandas is cool.
- 47:11For data analysis.
- 47:12Things like requests, SQLAlchemy.
- 47:15I think these are used by a lot of people, though.
- 47:18So I'm trying to think of it.
- 47:19Yeah, requests is downloaded 40 million times.
- 47:21Yeah, I'm trying to think of a more obscure, cool thing.
- 47:27Well, you're thinking of one of the ones that I was reminded of yesterday is something called passlib that'll do all the management of like hashing correctly passwords and stuff.
- 47:35Oh, okay.
- 47:37So you can say, here's a password.
- 47:38And I want to use SHA-512 hashing.
- 47:40And please iterate that hash 40,000 times so it's super computational to like, you know, brute force it.
- 47:46And boom, here.
- 47:47And that's like one line of code in that thing.
- 47:49That's beautiful.
- 47:49Okay.
- 47:50I have to look at that.
- 47:52Well, actually, this is a standard library module that's in Python 3 that I think blows people's mind.
- 47:58I had some people in a class.
- 47:59They were very fixated on manipulating IP addresses.
- 48:03Okay.
- 48:04I was like, you should look at the IP address module.
- 48:08This is something that's in the standard library in 3.4.
- 48:10There's a whole module just related to manipulating IP addresses.
- 48:14Wow, I don't think I've even touched that thing.
- 48:15Oh, it's like, yeah, iterating over like subnets and all sorts of things like that.
- 48:20That might be something to look at to kind of blow people's mind.
- 48:22Yeah, that is pretty cool.
- 48:23All right.
- 48:24Awesome.
- 48:24And the other question is, what editor do you like?
- 48:27I use Emacs.
- 48:28Emacs.
- 48:29All right.
- 48:29Right on.
- 48:30Yeah, I use Emacs back in the day.
- 48:32These days I've been doing PyCharm.
- 48:33I guess I'm patient, waiting for stuff to start to get all the features.
- 48:38I don't know.
- 48:38I have too much invested in Emacs at this point to give it up.
- 48:44You know, I've been using it so long.
- 48:48I don't know.
- 48:50Lost cause.
- 48:51Absolutely.
- 48:51We could almost have a Python 2 versus 3 type debate with Emacs versus Vim versus IDs.
- 48:57But we won't go down that path right now.
- 48:59Mostly I just like, I like to use Emacs to kind of troll people a little bit.
- 49:02So that's always, uh...
- 49:04Hey, it's written in Lisp.
- 49:05That's kind of fun, right?
- 49:06Always fun.
- 49:07Yeah.
- 49:07So, although actually my big shameful thing with Emacs, I have to admit that I never customize it.
- 49:13Oh my gosh.
- 49:14I know it has all that Lisp and stuff in there.
- 49:17Never go there.
- 49:19I have too many other projects to work on than that.
- 49:23You don't need to change your editor.
- 49:25Just get some work done.
- 49:26Just get work done.
- 49:28I actually wish they'd fix Idle a little bit.
- 49:31Yeah.
- 49:32Yeah, I could use some help.
- 49:33They like to hate on Idle.
- 49:35And I use it a fair amount for teaching classes.
- 49:39You know, it has the one feature of it comes with Python.
- 49:44And so if you're looking for just an easy way to get started without having to install all this stuff, it's great.
- 49:51But it could definitely use some love these days.
- 49:53Yeah, I agree.
- 49:54All right.
- 49:56David, I think that might make a show for us.
- 49:58That was a really interesting conversation.
- 50:00Before we head out, there's two things.
- 50:02One, I want to say people can find your tutorial on YouTube.
- 50:06In the previous show, I had a playlist of my favorite talks from PyCon 2015.
- 50:11And I'll put that in the show notes.
- 50:14But you can just go to bit.ly, B-I-T dot L-Y slash PyCon 2015 M-K, all lowercase.
- 50:20And that'll be a list of like 30 really good sessions from PyCon 2015.
- 50:24And yours is definitely in there.
- 50:26Okay, great.
- 50:27Awesome.
- 50:28And anything else you want to give a shout out to, let people know about?
- 50:30I don't know.
- 50:31If you like the tutorials, come take a class with me in Chicago.
- 50:34That'd be the only thing I'd say there, I think.
- 50:36All right, awesome.
- 50:36You got a website they should check out for that?
- 50:38They can find it on my personal site.
- 50:41Okay, cool.
- 50:42We'll put that in the show notes as well.
- 50:43Okay.
- 50:44All right, David.
- 50:45Thanks for being on the show.
- 50:46It's been fun.
- 50:46Okay.
- 50:47Thanks a lot.
- 50:49Today's guest was David Beasley.
- 50:51And this episode has been sponsored by CodeShip and Hired.
- 50:54Thank you.
- 50:55Thank you.
- 50:55Thank you for keeping this show going.
- 50:57Please check out CodeShip at CodeShip.com and thank them on Twitter via at CodeShip.
- 51:03Don't forget the discount for listeners.
- 51:05It's easy.
- 51:05Talk Python.
- 51:07All caps.
- 51:07No spaces.
- 51:08Hired wants to help you find your next big thing.
- 51:11Visit Hired.com slash Talk Python To Me to get five or more offers with salary and equity right up front
- 51:17and a special listener signing bonus of $4,000 US.
- 51:21Remember, you can find the links from the show at Talk Python To Me.com slash episodes slash show slash 12.
- 51:29Be sure to subscribe to the show.
- 51:32Open your favorite podcatcher and search for Python.
- 51:35We should be right at the top.
- 51:37You can also find the iTunes and direct RSS feeds in the footer of the website.
- 51:42This is your host, Michael Kennedy.
- 51:43Thanks for listening.
- 51:44Smicks, take us out of here.
- 51:47Stay tuned.
- 51:48Stay tuned.
- 51:48Stay tuned.
- 51:49Stay tuned.
- 51:49Stay tuned.
- 51:49Stay tuned.
- 51:51Haven't been sleeping.
- 51:52I've been using lots of rest.
- 51:54I'll pass the mic back to who rocked it best.
- 51:57I'll pass the mic back to who rocked it best.