Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book

Transcript #145: The Python 3 “Y2K” problem

Return to episode page view on github
Recorded on Wednesday, Aug 28, 2019.

00:00 Hello and welcome to Python Bytes where we deliver Python news and headlines directly to your earbuds.

00:04 This is episode 145 recorded August 28th, 2019.

00:09 I'm Michael Kennedy and Brian is away on vacation.

00:13 Yeah, I was on vacation last week.

00:14 Now Brian's gone, but don't despair.

00:16 We have two special guests.

00:18 We have Matt Harrison.

00:19 Hello.

00:20 Welcome, Matt.

00:20 And Anthony Sottile.

00:23 Welcome.

00:24 First time here on the show.

00:25 Nice to have you here.

00:25 Nice to be on the show.

00:26 Yeah, it's great to have you.

00:27 I'm looking forward to talking about all these things with you.

00:30 Now, before we get on to our topics, let me just say real quickly, the show is brought to you by Datadog.

00:34 Check them out at

00:37 More on that later.

00:39 But I want to focus first on something that's going to help people learning Python or teaching people who are learning Python.

00:49 And that's this project called Friendly Traceback.

00:54 Matt, you do a lot of teaching.

00:55 What is your experience with folks, you know, what are their first programming experiences running into like a traceback crash?

01:02 Like, is it really clear for them?

01:03 Most of my training is with experienced technologists who understand what a traceback is.

01:10 So, I do do some with kids in elementary school, that sort of thing, but my issue is I like the idea here, but in my courses I teach explicitly have them hit errors and teach them how to read the trace back and recover them.

01:28 How to recover, yeah.

01:29 So I like the idea.

01:30 The other thing that I have sort of an issue with is that you have to install it, right?

01:35 So having someone who's a beginner install something, I don't know.

01:41 What do you think about that?

01:41 That's an interesting question, because you--

01:44 well, let me tell folks what it is real quick.

01:46 So this one comes to us from Jose Carlos Garcia, I think, because his Twitter name is in elite speak.

01:51 So that's my attempt to understand it back into English.

01:53 (laughing)

01:55 Thank you, Carlos, for sending that in.

01:57 And the idea is it's really aimed at beginners, as you kind of hinted at, Matt.

02:01 And let me just give folks a sense of what it is.

02:04 So normal traceback will have, like, in reverse order, the call stack, and then maybe the line of code, and then the error message, like the error type, and then possibly the error message, right?

02:16 Well, what this does instead is it will catch the exception type like an index error, and then it has a little help message and an example.

02:25 Right, so it says, oh, this was a Python exception, you got an index error, that means the list index is out of range in this case, and this error occurs under these circumstances, here's usually what happened, here's usually the cause.

02:37 And then one thing I really like about it is it first shows the line of code where it happened, and then it actually shows the local variables.

02:44 So like in the example there, it has a function called get last item and you're passing a list, And it says the list that was passed was 1, 2, 3.

02:53 And then here is actually like three or four lines of code where this error is happening and what the index value was and all that.

02:59 So you could actually diagnose this without even stepping into a debugger.

03:04 You could just say, oh, I see.

03:06 The index is 3, but actually it's 0, 1, 2 by just looking at the output on the screen here.

03:10 And that I think is pretty cool.

03:12 Yeah.

03:12 I think it's definitely useful.

03:14 I looked over the documentation.

03:16 I thought, this is really cool.

03:18 My issue with beginners is how to walk them through something.

03:23 And installing is always a pain when they're beginners.

03:27 I also-- the other thing that's really cool about it is it looks like it has some hooks.

03:32 So you can define your own exceptions.

03:35 You can customize how you handle those.

03:38 So I think that looks kind of cool as well.

03:40 I mean, I can imagine maybe if you're in a environment at work where you have support people, and they might have to look at your code or look at your servers and take problems and resolve them.

03:56 This might be something that could aid them.

03:58 - Right, the fact that it catches the local variables in production would be kind of nice.

04:03 Yeah, I think it really comes down to, are you using any external packages?

04:07 If there's a pip install or a condo install, you could wrap this up to include friendly traceback, but if you're using none of that, then all of a sudden, yeah, this is like another burden, right?

04:17 - Yeah. - Yeah.

04:19 - This actually looks a lot like the pytest tracebacks.

04:22 I sometimes find that those are useful and sometimes not so useful.

04:25 - Yeah, exactly.

04:26 I think it depends.

04:27 Like they said that there's a lot of tools to make exceptions better for advanced developers.

04:31 This is not that.

04:32 This is something else.

04:34 One of the things I thought that was cool about this is there's three ways to like integrate it into your app.

04:38 You can install it as an exception hook.

04:41 So all exceptions of the application are caught, which is cool 'cause I mean, I knew that that was possible, but I didn't really, I've never really played with that.

04:49 And I'm like, oh, look how easy it is.

04:50 You just take a function and assign it to this callback globally and any error will go through it.

04:56 That's cool.

04:57 So you can do that at the top of like your startup, your app.

05:00 You can actually, in a try except block, you know, say explain, friendly trace back explain, and it'll do that on demand.

05:08 But both of those require you changing your code.

05:10 You can also use it from the outside when you run an app, you can say -m friendly trace back, then the script file, and that way you can run it on code that's not modified to be friendly, I guess.

05:21 Unfriendly code, what do you call it?

05:22 I don't know.

05:23 Anthony, let's wrap this up.

05:25 What are your thoughts on this thing?

05:26 - Looks good.

05:27 I'm actually teaching my brother how to program right now, and he was pretty overwhelmed by the first stack trace that he saw, and I think if he would have saw something like this, it would have changed his perception about errors and maybe taught him something more than I had to teach him after the fact.

05:42 Exactly.

05:43 It looks pretty cool.

05:44 Yeah, I totally-- I think it's awesome.

05:45 I really, really like the idea.

05:47 I do take Matt's point as valid, as like it's now a step preceding actually writing code that they've got to go through.

05:54 So depending on how much control you have over their environment, if you can get this in place for them, then maybe it's no big deal.

06:00 But yeah.

06:01 Anyway, worth considering.

06:02 Matt, what have you got next for us?

06:04 So recently, the Pandas developers released the Pandas User Survey from 2019.

06:10 So this came out last week.

06:11 They had a call on Twitter, and they had about 1,200 responses.

06:18 Yeah, that's cool.

06:19 I was surprised they got so many folks to participate.

06:21 Those are really solid numbers for statistics.

06:24 Yeah.

06:25 I think we've got a link to the survey there.

06:27 But some of the things that stood out to me is that more than half of the people who responded have been using Pandas for less than two years.

06:36 Penn has been out for quite a while now, but it seems to be one of--

06:43 from what I see, it's one of the key drivers of growth.

06:46 It's just sort of a central component of the data analysis, data science space.

06:51 And it looks like they're getting a lot of new users there.

06:55 Yeah, so we talked about the incredible growth of Python before.

06:59 And a lot of that has to do with this big inflection point where Python was largely adopted, moved to by data scientists.

07:07 Do you think this is an indicator of that?

07:09 There's all these new folks coming into the Python ecosystem, and they're often coming into the data science space.

07:14 And so hence, they haven't been here for many, many years?

07:17 Yeah, I think so.

07:18 I mean, that's the sexy thing right now, data science.

07:21 And it kind of didn't exist before, so there's a big push for AI, ML, that sort of thing.

07:27 But if you look at the number one tool that data scientists use, it's often called Python.

07:33 And I would say that Pandas is probably the number one tool of those people who are using data science.

07:40 Yeah, cool.

07:41 What else is in the survey?

07:42 What was really interesting is they have the numbers of the operating system.

07:45 So I sort of geek out on that sort of thing.

07:47 But this isn't what I would have thought at all, because some definitions of data scientists are they're a statistician who uses a MacBook in San Francisco.

07:57 Yeah, you definitely do better data science if like the back of your laptop glows in Alienware, maybe, but certainly in Apple.

08:05 No, I'm just kidding.

08:07 Yeah, so the numbers, actually, they have about 60% of their users use both Linux, 60% use Windows, and 42, Mac.

08:18 So I wouldn't have thought that.

08:19 I mean, obviously, those don't add up to 100.

08:21 So I imagine you've got a lot of deployments on Linux, that sort of thing.

08:25 But people tend to forget that Linux sort of rules the enterprise world.

08:30 And I think this might be further indication that Panda's adoption or Python's adoption is not limited to just startups and people hacking around on their MacBook.

08:41 - I'm always super surprised by the percentage of Windows users when you consider Python.

08:45 And I guess it makes sense 'cause it's really easy to get started with Python on Windows, but the number just blows me away every time.

08:51 - Yeah, absolutely.

08:53 Steve Dower did a great talk at PyCon called "Python is Okay on Windows Actually" or something like that.

08:58 And he has some really interesting--

09:00 - That was a great talk.

09:01 - Yeah, it was really good.

09:01 And it had some interesting statistics.

09:02 I feel like the Windows Python developers are somewhat in this realm of like the dark matter developers in that you know they're using it 'cause it keeps showing up in these surveys, but you go to PyCon and there's many more MacBooks toting around and whatnot.

09:18 But yeah, it's definitely a good thing to remember.

09:20 You know, honestly, Matt, the thing that surprised me most here is how high Linux is in this group.

09:24 - Yeah, I imagine that's deployments, But the other interesting number here is Python 3 percentage.

09:31 And Python 3 percentage is 93%.

09:34 So legacy Python, goodbye there, I guess.

09:37 The data scientists move on to the latest and greatest.

09:40 Yeah, the data scientists are leading the way with ditching legacy Python.

09:45 I mean, the whole Python 3 statement came out of that space, which is pretty cool.

09:50 I think that also has to do with less legacy code, as well as the models and the technology are changing so fast.

09:56 you don't keep building on the same code.

09:58 You're like, forget that.

09:59 We're going to go to TensorFlow, because this whole thing is slow and wrong, right?

10:03 Yeah, like you said, I think they're leading the way.

10:05 Well, speaking of Python 3, I think Anthony has something around that as well.

10:10 Yeah.

10:10 I do indeed.

10:11 Yeah, let's talk about the Y2K problem that I kind of stumbled upon recently.

10:16 The YP3 problem?

10:18 Yeah.

10:19 [LAUGHTER]

10:20 Yeah, OK, what is this?

10:21 Python 3.8, close to release, and Python 3.9 right around the corner.

10:25 There's the question that comes up, which is, what is going to come after?

10:29 And we really have two main choices, which would be Python 3.10 or Python 4.0.

10:35 But both of these present problems just because of their version number.

10:39 So there's a significant amount of code out there that's using the sys.version and sys.version info variables in the sys module.

10:46 Right, and trying to just take that string and go, is there a Python 3 or 2 in here, or something like that, right?

10:52 Yeah, there's a lot of slicing or checking the first character of that string, and it presents a number of different problems.

10:59 The most common one that I've seen is when you access sys.version and look at the first three characters, and that works fine, 2.7 or 3.6 or whatever.

11:10 But as soon as the second minor version of Python becomes 10, you're suddenly reporting Python 3.1 again.

11:16 - All right, sorry, this doesn't support Python 3.1.

11:18 You need at least version 3.5.

11:20 You're like, no, it is 3.5.

11:22 - There's an even worse situation where if you check, even if you're doing it correctly and using sys.versioninfo, if you only check the first number and only check equality, so like say, sys.versioninfo 0 equals equals 3, that's a perfectly fine check if you're checking if it's exactly Python 3.

11:40 But as soon as Python 4 happens, that condition is going to be false.

11:45 And guess what?

11:45 You're going to run Python 2 again.

11:47 Yeah, some of the maintainability libraries, like 6, have this in there, right?

11:51 Yep.

11:51 Yeah, 6 is broken if you change the version to 4, which is a little scary given it's one of the most installed libraries, as we'll see later.

12:00 - Yeah, well, I guess that makes sense because six is not divisible by four, so it's probably fine.

12:05 No, actually, this is really tricky.

12:07 You know, it reminds me of Windows 10, right?

12:09 Like, if you look at the Windows operating system numbers, we had Windows 7, which was XP, Windows 8, which was Vista, and then Windows 10.

12:18 And the reason they don't have a Windows 9 is exactly this.

12:22 Like so many people were doing substring searches for Windows space nine for looking for 95 or 98.

12:28 And so if they had a nine that was beyond, you know, Vista or whatever.

12:32 - Yeah, even Oracle Java had that problem.

12:34 - Yeah, it's, so they just said, you don't forget it, we're going to 10, but it doesn't sound like skipping to four is going to make this better, probably worse.

12:42 I don't know, what you think is the worst way to go?

12:44 - I think skipping to four is going to be worse.

12:46 Most of the things with the 3.10 release will just be like slightly broken, but trying to run Python 2 code in Python 3 is way more broken.

12:57 - Yeah, for sure.

12:58 - So I haven't followed this, but I recall, and maybe my memory's just fading me, that there was talk that there would never be a Python 4.

13:07 So has that changed?

13:09 - As far as I know, that hasn't changed.

13:12 - I think the jury's still kinda out on that one.

13:16 From what I understand, there was talks with Python 4 just being the next version of Python 3.

13:22 But I don't think anyone has definitively chosen whether it'll be 3.10 or 4.0 next.

13:28 - Yeah, I mean, we're at this crossroads, right?

13:30 Guido has expressed a dislike of double-digit second version numbers.

13:35 But everyone is tired of this two versus three debate.

13:38 We don't wanna kick it up a notch, right?

13:40 So where do you go from there, right?

13:41 - Well, just release forever.

13:45 - That's right.

13:46 Yeah, it'll be fine.

13:47 Yeah, this actually is coming up pretty quickly.

13:49 So 3.9 will reach beta, according to the pep, will reach beta sometime in 2020.

13:56 And usually when the next version releases on beta, they start developing the version afterwards.

14:02 And so we'll start seeing 3.10 in the wild.

14:04 But I made a couple of easy ways that you can start fixing these problems before they're a problem, I guess.

14:10 One of them, I pre-built a version of Python 3.10.

14:14 Well, it's actually 3.8, but with a fake version number.

14:17 And you can run that directly on Ubuntu today.

14:19 And I made a Flake 8 plugin, which checks for these common issues called Flake 8 2020.

14:25 - Nice, yeah, that's really cool.

14:26 Yeah, mix it into your container.

14:28 - So does that suggest that you use version info instead?

14:31 - Yeah, it makes the proper suggestion when it detects which thing that you're using incorrectly.

14:35 - Cool. - Yeah, super.

14:36 And that's great.

14:37 Now, before we get to the next one, let me just tell you all quickly about Datadog.

14:40 They're long-term supporter of the show.

14:43 And Datadog is a modern cloud-scale monitoring platform It brings all your metrics and logs and distributed traces together.

14:50 So basically it will auto instrument all the popular frameworks, Django, Flask, Postgres, whatnot, and you can actually trace your requests and your performance across different service boundaries.

15:01 So not just what is your Python code doing or what is your database doing, but like all together in one coherent thing, which is cool.

15:08 If you go to a free trial with them, you'll get a cool Datadog t-shirt.

15:12 Just visit to get started.

15:16 Now, Anthony, you had hinted that we may come back to popular packages.

15:20 And some folks out of the, I think they're associated with the University of Michigan, but they also have their own consulting project, these two folks, they did some interesting research on the current state of PyPI.

15:33 Now, sometimes people use BigQuery, you can ask interesting questions like, well, what are the most common user agents downloading from PyPI?

15:40 Or what are the most common packages or whatever?

15:44 These folks went all in and they downloaded all of the packages from what I can tell, like all of them.

15:51 And then they started analyzing all sorts of stuff about them.

15:55 So they started saying, "Look, we downloaded 178,592 packages, which has roughly 1.7 million releases and 77,000 contributors." And they also analyzed something that was pretty interesting, the connections or the interconnectivity or dependency graphs of these various things.

16:17 And they found there's 157 million import statements in these packages.

16:24 And then, yeah, they just did a bunch of analysis.

16:26 This is basically like an academic research paper.

16:29 So the thing I'm linking to is actually a PDF.

16:32 So look for a download you're going to get rather than a website they set up.

16:36 Yeah, it's pretty interesting what these guys put together.

16:39 What do you see that caught your attention going through this?

16:42 I went to their... I read the paper and then I looked at...

16:46 They actually have a GitHub project, and I wanted to actually pull the data from the GitHub, but sadly the data is not there.

16:51 It says "coming soon" because I wanted to do some analysis on it.

16:53 Ah, bummer.

16:54 So my question is, what do you think is the most common third-party library?

16:59 And it wasn't what I thought it would be.

17:01 I mean, my guess was just going to be like six, because you see that everywhere.

17:05 and all sorts of projects.

17:06 Yeah.

17:06 It's super, super low level.

17:08 Yeah, I would have guessed requests.

17:10 Yeah, that would have been my guess as well, I think.

17:12 But the most common was NumPy, which surprised me.

17:16 Those data scientists, they're really dominating.

17:20 I don't know.

17:21 They definitely are.

17:21 Wow.

17:22 How interesting.

17:23 So certainly, so many of these libraries that are in the data science space do seem to all focus in on NumPy as the foundation, don't they?

17:31 Yeah, it's sort of built around that as well.

17:33 I wonder how much more commonality there is, like more shared foundation there is in the data science space, rather than say the web space, where you've got Flask, Django, Pyramid, Bottle, Molten, whatever, and they all kind of have their own foundation.

17:48 So that breaks up their potential - Code-y high-res. - Yeah.

17:53 That was definitely interesting, NumPy.

17:55 I wouldn't have guessed that, but I guess it does make sense.

17:58 So some interesting things that I saw was within PyPI, They said they find that the growth of the repos--

18:05 of PyPI itself, all the packages, has been robust under all measures, with an annual compound growth of 47% year over year for the number of active packages, and 39% for new authors, and 61% for new import statements.

18:24 So I guess that means Python packages are becoming more dependent on each other.

18:29 Yeah, that does make sense.

18:32 Again, when I'm doing a training, I will go to PyPI, the Python package index, and I point them at that number.

18:39 And I'm at it right now, and it says 193,830 projects right now.

18:44 And I think that's pretty mind-blowing.

18:48 But it's also, like you said, you've got 47% growth in there, 39% for new authors, right?

18:55 So--

18:55 Yeah, that's incredible.

18:57 Apparently, it's somewhat straightforward for someone to come into Python, make a package, and start contributing and sharing it with the community.

19:06 - I think the new authors is the most impressive stat from there, like it means that people are coming into the community and like building stuff for other people, which is great.

19:15 - That's a really good point, yeah, absolutely.

19:17 That's a super positive number.

19:18 That's really high growth when you're talking about, you already have 77,000 authors, right?

19:23 - Yeah.

19:24 - Some other real quick stats I thought was interesting.

19:26 They have the number of active packages, which is a much smaller number than the total packages.

19:31 But in 2005, you could go to PyPI, and you could literally just kind of browse all the active packages.

19:38 There were 96.

19:40 So in the early days, it was useful to have it, but it was not quite as amazing as almost 200,000 now.

19:47 Before PyPI, there was this cheese shop, which I think was the predecessor of that.

19:51 And it was sort of a single web page, and it had like, here are the categories, right?

19:56 And so on that web page was a list of packages.

19:59 But yeah, this is crazy.

20:01 - Yeah, so the cheat shop, as you're telling me, it's kind of like Yahoo for packaging.

20:06 - Yeah.

20:07 - All right, final stat from this analysis.

20:10 The most popular license for packages in the Python space is MIT.

20:15 They've got all the lists, all most of them.

20:18 That's pretty cool.

20:19 All right, Matt, what's this next one?

20:20 Speaking of data scientists, you got another one for us.

20:23 - Yeah, so speaking of data scientists and sort of, I guess, the proliferation of--

20:28 Michael mentioned proliferation of web frameworks.

20:31 I came across a new project that I hadn't seen before recently called DAPY.

20:37 D-A-P-Y.

20:39 DAPY.

20:40 DAPY.

20:41 And it sort of labels itself--

20:43 it sort of labels itself as Pandas for Humans.

20:46 Not precisely, but it says for humans somewhere in its web page.

20:50 And so I just think this is interesting now.

20:54 So, manipulation of web frameworks.

20:56 And I recall, you know, when Django came out, at that time, there was another popular web framework called TurboGears, and there was sort of a faction in the Python community of like, are you a TurboGears person or you're a Django person, right?

21:10 And they both sort of had their pluses and minuses, right?

21:15 But I think, and TurboGears has sort of morphed into what we see as Pyramid these days.

21:19 But I see that there's been benefit, I think in general competition is good, and there's been benefit from that.

21:25 This is an interesting library.

21:27 It looks like it's pandas-esque.

21:30 It's got portions of pandas in it, but it also has Scikit-learn in it, Yellow Brick, which is a visualization tool for machine learning, and NumPy as well.

21:40 It says explicitly on there that it's designed for data analysis, not for coders, which I think that's trying to say that maybe pandas is a little too complicated, and that data analysts maybe need something a little bit more simple than that.

21:56 But I think it's interesting that there's now a proliferation and people are using Python and maybe they're saying, "Oh, we want to use Python, but we want to use maybe something simpler," and there's a proliferation there.

22:08 Yeah, I think it's super interesting.

22:09 One of the things it seems to do is also leverage the simpler startup idea, kind of like you talked about before.

22:16 A lot of folks say, "Well, you get started by setting up a Jupyter server and installing pandas and NumPy and all that stuff.

22:23 And one of the things you can do with this is you can have one of these data sheets, and you can say show, and it will print out an ASCII representation of the table and stuff like that.

22:34 Yeah.

22:35 In general, with most software, a good five-minute out-of-the-box experience is really good for bringing someone on, right?

22:42 It'll be interesting to see what happens to this moving forward, because what I'm also seeing is a lot of new projects are taking the interface from pandas and replicating that.

22:55 And you've talked to people who are doing similar things, right?

22:57 Yeah, like Dask, for example, and stuff like that.

23:00 Like Dask. I was just playing the other day with a library called CUDF.

23:06 I don't know how you pronounce that, but basically it's a pandas on top of CUDA.

23:13 So you can leverage your GPU to do pandas-like operations.

23:18 So it'll be interesting to see where that goes.

23:20 It looks like, in general, the data science community is sort of honing in or adopting the pandas interface as sort of a standard interface.

23:30 But is there room for improvement, room for something more for humans?

23:35 I guess that remains to be seen there.

23:37 Yeah, it definitely seems like a lot of flowers are blooming.

23:39 Yeah, which I think, in general, is good.

23:41 Competition's good.

23:43 And if you only have one tool, you have to use that tool, right?

23:47 But if there are multiple tools and some are better at certain things, then I think it pushes everyone to be better.

23:52 So appreciate the competition there.

23:54 - For sure.

23:54 - How do you think a programming library that's not for coders works out?

23:58 - Yeah, I'm not sure how to interpret that.

24:02 - You start by installing friendly traceback, and then you go from there.

24:05 - Yeah.

24:07 Good one.

24:08 I mean, I also consider Excel a programming environment, right?

24:11 I think Excel is the most common programming environment in the world.

24:15 And lots of people use it.

24:17 They won't admit that they're programming, but I mean, if you do a V lookup or something like that, you're, you're programming using Excel.

24:24 So.

24:25 And Google sheets is a great database.

24:27 Yeah.

24:27 At some point, I think you have to bite the bullet and, and learn some syntax.

24:31 And so I, I'm not quite sure how to interpret that statement there, but friendly interface, pandas has gotten some slack for, for some things that might not be super intuitive or not Pythonic in that way.

24:43 So whether this is improvement on that--

24:46 Maybe it's a way to graduate to pandas.

24:47 Yeah.

24:48 Yeah.

24:48 This is your training wheels.

24:50 Yeah, potentially.

24:51 Potentially.

24:52 Now, I started off this whole conversation by saying we could use this friendly traceback to possibly gather information about crashes on the server because it captures local.

25:03 But Anthony, this next one, you've got my ticket up a notch, right?

25:07 Yeah.

25:07 I'm actually going to talk about Python Remote PDB.

25:10 This is intended to be a small over-the-network remote debugger.

25:14 It's a very, very thin wrapper around PDB that ships in a single file.

25:18 It's really easy to drop into an existing environment and just add it to your path using Python path, or you can pip install if that's easier for you.

25:28 It doesn't have all that many features.

25:30 There's a bunch of other remote debuggers that are much more powerful, things like PUDB or RPDB or PyCharms debugger or Visual Studio Codes debugger or like any of the other things that are brought to the table.

25:43 But I found this, it was pretty simple.

25:45 It solved my use case and worked pretty well.

25:48 - That's cool.

25:49 So it integrates with Python's new breakpoint feature, which lets you plug in a new debugger, right?

25:56 - Yep, yeah.

25:57 You just set some environment variables and anytime you call breakpoint in your code, the runtime knows how to import the right module and call the right stuff to call your debugger.

26:07 So if you wanted to call remote PDB, you would just set Python breakpoint equals remote PDB dot set trace, and it would just do the right thing.

26:15 - Yeah, that's pretty cool.

26:16 - Yeah, and the access for this tool is, you generally just use like Telnet or Netcat or Socketcat or anything that can talk to a socket and basically gives you a PDB session remotely.

26:29 I'm actually working on creating my own text editor just so I can learn Curses.

26:33 And it was really useful to be able to debug a Curses application because you can't really enter PDB while it's trying to paint your screen.

26:40 Yeah, that's interesting.

26:42 So, I mean, even though it sets up a little server, you don't have to have it be on a different machine, right?

26:47 Yeah, I was just developing it in one tab and I had a debugger in my other tab.

26:52 Yeah, so in general, anything that's printing to--

26:54 if you've got something that's printing to the screen or maybe doing input from the screen, that might be a case where this would be more appropriate than the built-in debugging tools of Python.

27:04 - Yeah, another use case might be if you're using a web server, although Flask has nice tools for using a debugger and Pyramid does as well, and I'm sure the others do also.

27:13 But it's a potential tool.

27:15 - Yeah, it's cool.

27:16 - Yeah, more tools are good.

27:17 Tell folks really quick what Curses is.

27:19 - Curses is a library which allows you to paint graphical user interfaces, but in a terminal.

27:26 It's kind of how text editors like Vim or Nano or Emacs draw out their UI.

27:31 Or if I wanted to create a game for like a BBS.

27:34 Oh yeah, you can make games with it too.

27:36 I've seen some really good Cursus games.

27:38 Yeah, that's pretty cool.

27:39 All right, well, that's definitely a good one.

27:40 And I hadn't heard of it.

27:41 So yeah, thanks for sharing that.

27:43 And that's it for our main topics.

27:44 But I do have a few quick extras I know we all do that I want to share.

27:49 I just want to share a story that just made me laugh.

27:51 I really love it.

27:52 So there was this-- the press calls them a hacker.

27:55 I don't really know what this person would be classified as, because it's like a pretty low-level hack.

28:00 But a person was trying to avoid getting parking tickets.

28:05 And they assumed that if what they could insert into the field that contains the number for the license plate was null, the systems, like at the county or whatever, is going to give you a ticket.

28:18 They say, oh, there's no address, or there's no license plate, so we can't send them a ticket.

28:23 But in fact, quite the opposite is the case.

28:25 So there's this person who got a custom license plate, which you can do in the US and have words on it.

28:30 And they got the word null, N-U-L-L, all capital.

28:34 And then all of a sudden, all the other places where there actually were nulls in the database started directing to this license plate.

28:44 And they got $12,000 in parking tickets without even parking illegally because they started to receive all the failure cases of the database for parking.

28:53 Ah, guess he hacked himself.

28:55 Exactly.

28:56 I don't know, hackers would take kindly to the naming there, but I don't think it worked out how he wanted it to.

29:03 It was definitely a backfire.

29:04 Anyway, I'll link into that, that's pretty funny.

29:06 And then just really quick, PyCon 2020 has been sort of officially announced.

29:12 It's going to be earlier this year, I'm trying to figure out exactly.

29:15 Yeah, yeah, it's going to be April 15 to 23 in Pittsburgh.

29:21 And the website is already up.

29:22 So go check it out.

29:24 Sign up.

29:24 Maybe you can submit a talk.

29:26 I'm not entirely sure.

29:27 But the website, at least, is already up.

29:28 So I'll link to that.

29:29 People can check that out.

29:30 Matt, what do you got?

29:31 I recently released a course on Pluralsight on the XGBoost library.

29:37 So XGBoost, if you're not familiar with it, is a library that a lot of people are using with great success in like Kaggle competitions for analyzing structured data and making predictive models around that.

29:50 So if you're interested in an in-depth course on XGBoost, not only how to use it, but how to tune it, how to understand what the model is predicting when it comes out, check that out.

30:02 I've got a link,, plural site, XGBoost, so psxgb if you're interested in that.

30:11 - Nice, yeah, we'll put the links in the show notes.

30:13 Congrats on the new course.

30:14 You and I have both written a fair number of online courses and that's a lot of work.

30:18 - Yeah, thank you.

30:18 Yeah, I'm excited about it.

30:19 I think it's a great course for anyone interested in NextGBoost.

30:23 - Yeah, awesome.

30:24 Anthony?

30:25 - Cool, I've got one quick little library.

30:27 This is on the same line as the Curses work above.

30:31 I found a tool called Ekate.

30:33 I don't know how to pronounce it.

30:34 It labels itself as a Selenium WebDriver, but for the terminal.

30:39 And it's kind of a cool library that allows you to control a process in the background and make assertions about it as a testing library.

30:46 - So are you sending curses commands or is that like expect?

30:52 - So the way it works is it runs a TMUX server in the background and then uses the TMUX commands to interact with it.

30:58 So it'll sound like up arrow or like control X or--

31:02 - Like sends keys kind of.

31:03 - Yep, pretty much.

31:04 - Ah, that's cool.

31:06 - Yeah, and then it takes three rounds of--

31:07 - That's a utility in that for like driving demos and that sort of thing as well.

31:11 That's cool.

31:12 - Oh yeah, that'd be cool.

31:13 - Yeah, you sit there and it looks like you're typing and you're just flying through it and you just get up, you say, let me show you some over here and it just keeps going.

31:19 Feel right?

31:19 (laughing)

31:21 - Yeah, yeah, and you could make it understand Emacs.

31:24 It could even control Emacs, awesome.

31:26 - Yeah.

31:27 - Yeah, works great for Emacs too.

31:29 - Sweet, all right.

31:30 We always end the show with a joke or two and this one is not like a laugh out loud sort of joke, But Matt, you're here, you do a lot of data science.

31:39 I thought I'd bring some sort of scientific-esque humor here.

31:43 And this one just really is deeply satisfying to me.

31:46 So it's a little story.

31:48 I'll get y'all a reaction in a minute.

31:50 So there are two mathematicians sitting at a table in a pub having an argument about the level of math education among the general public.

31:57 Like, one of them is defending overall math knowledge.

32:00 And he gets up and goes to the restroom.

32:03 And on his way back, he wants to prove his point, right?

32:06 So he encounters the waitress and says, hey, I'll give you an extra $10 on your tip if you can answer a question for me.

32:13 It doesn't matter what I ask, just say the words X squared.

32:17 X squared, OK?

32:18 She's like, yeah, sure, no problem.

32:20 So a few minutes later, the guy sits back down with his buddy and says, I'll bet you $20 that even our waitress can tell us the integral of 2x.

32:26 And the cynic's like, yeah, I'll take that bet, buddy.

32:29 No problem.

32:30 So he beckons her over to the table, asks the question to which she replies, X squared.

32:35 And this mathematician begins to goad and demand is winning.

32:37 She says, plus a constant.

32:39 [LAUGHTER]

32:42 I don't know why I like that one.

32:46 At least she knows.

32:47 I don't know why I like that one, but it's just satisfying to me.

32:50 So yeah.

32:51 So on that, I'm going to brief aside.

32:54 There was a poll on Twitter the other day whether they should teach statistics or calculus in high school.

33:00 That's an interesting question.

33:02 The only times I've used calculus since high school, even though I much enjoyed the class, was tutoring other people in calculus.

33:09 So--

33:10 - That's a good career path, by the way.

33:12 Just, you know, when you're young, that's for, no, I hear you, but I honestly, if you're gonna throw up a math class in high school for sacrifice, geometry.

33:23 It's gotta be geometry.

33:24 Replace that with some computer programming.

33:26 Serve as the same purpose, logical thinking.

33:28 Let's do it.

33:30 - Awesome.

33:31 - But yeah, I definitely take your point.

33:34 All right, Anthony, do you have another joke or you wanna, should we wrap it up?

33:37 - I had a Golang joke prepared, but then I panicked.

33:41 - Whoa.

33:42 - Whoa.

33:42 - Ow. - You can cut that too.

33:45 - No, no, it's all good. - Don't worry about it.

33:47 - It's all good, man.

33:49 Thank you, Matt Harrison, Anthony Sotile.

33:52 Thank you both for being here.

33:53 It's been really great to have you, Matt, back on the show and Anthony here for the first time.

33:57 - Yeah, thanks for having me.

33:58 - Yeah, thanks guys, bye.

33:59 - Okay, bye.

34:00 - Thank you for listening to Python Bytes.

34:02 Follow the show on Twitter via @PythonBytes, that's Python Bytes as in B-Y-T-E-S.

34:07 And get the full show notes at

34:10 If you have a news item you want featured, just visit and send it our way.

34:15 We're always on the lookout for sharing something cool.

34:17 On behalf of myself and Brian Auchin, this is Michael Kennedy.

34:21 Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page