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


Transcript #42: Behold: The Python 2 death clock

Return to episode page view on github
Recorded on Wednesday, Sep 6, 2017.

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

00:05 This is episode 42 recorded September 6, 2017.

00:10 I'm Michael Kennedy.

00:11 And I'm Brian Ockett.

00:12 And we have the band back together again.

00:14 How about that, Brian?

00:15 Thank you so much for carrying the Python Bytes news banner while I was gone.

00:19 And then like I get to pay you back straight away a little bit.

00:22 Yeah, it was fun listening to 2.1 with you and I'm blanking right now.

00:28 Yeah, Miguel.

00:28 Yeah, Miguel, it was great.

00:31 And then it was kind of fun to talk with some new people.

00:33 But I'm not ready to replace you yet.

00:35 Yeah, no, no, I think this idea of maybe every now and then having someone else drop in and give it a fresh set of topics might be cool.

00:41 But yeah, no, it's great to be back together.

00:43 So before we get started, I just want to say thanks to Datadog for sponsoring this show.

00:47 You can check out what they their special offer at Python bytes.fm slash Datadog, which is actually really cool.

00:53 You get something out of it.

00:54 So that's, that's sweet.

00:55 Let's talk about what a couple of the one of the prolific Python developers out there.

01:02 Just in one week, what he's been up to.

01:03 Yeah, I think it was the last week.

01:06 Kenneth Reitz has been very prolific.

01:09 And it's I don't know if he's, he's got insomnia, and he's not sleeping lately.

01:15 But he's put out a bunch of stuff recently.

01:17 And instead of spreading it out entirely, for our entire episode, we're just gonna lump it all together.

01:23 - So this basically could be an entire episode.

01:25 - Yeah, it could, but you know.

01:27 - That would be wrong.

01:28 - That would be wrong.

01:29 So first off, I think this is cool.

01:30 So if you're a Mac user, maybe you use Homebrew to install stuff.

01:36 And one of the things he's put together is Homebrew Pythons, which is a tap.

01:41 I didn't know there was a thing called Homebrew taps, but it's a way that you can get all Python 2.5 through 3.6 installed easily with just a couple of command lines.

01:52 Yeah, it's beautiful.

01:53 You just basically register Kenneth's tap and then you just say brew install Python dash 3.6 or 2.7 or whatever.

02:03 I really like brew and I've been starting to use it more and more for my Mac.

02:07 The next time I set up a fresh operating system, which seems to be about like yearly, I get frustrated and format the thing.

02:14 So next time I'm going to just brew install as much as I can like MongoDB, Python, Node.js, the things that you need. It's beautiful. Yeah. Okay. Well, moving on. Next up, we've got a request thread requests threads, which is a I think it's something built on top of requests that uses twisted deferred objects as a return object for requests. And so you can use it with either async and await or with twisted to have asynchronous reading through requests easily.

02:48 - Yeah, it's really, really cool.

02:49 So basically you create this async session and you just say await session.get.

02:55 So you have actually two ways.

02:56 You can do async await Python 3.6 style, which is really cool.

03:00 Or you can use twisted deferreds, which work in basically every version of Python.

03:06 So you actually can pick and it's really, really cool.

03:09 So I'm looking forward to seeing that rock and it basically looks like the last activity on everything was a couple of days ago.

03:16 So yeah, this is kind of new.

03:17 It's kind of cool.

03:18 - And also, before we move on, I really enjoyed your, you interviewed somebody about Twisted recently.

03:23 - Oh yeah, yeah, that was Glyph.

03:24 That was the most recent episode that's out, but probably not by the time.

03:28 That was 127 on Talk Python.

03:29 Thanks, yeah, he's doing amazing stuff.

03:31 And so that kind of riffs on this as well, for sure.

03:33 - Okay, now thinking about, instead of threads, you might want to just have a background task, and Kenneth has that too.

03:40 He's got a repo called Background, which just runs stuff in the background.

03:45 Yeah, it's beautiful.

03:46 You basically put like a decorator on a function and then it becomes this async background thing that you just kick off like fire and forget style.

03:53 It's really, really cool.

03:54 Like, you can do it for CLIs, you can do it for web apps.

03:57 I use this and the Talk Python Training site, this type of stuff.

04:00 I don't use this because it's new.

04:03 But like when I first built it and you know, may give you the capability to like email thousands of people and update.

04:10 It turns out that that's really bad to do in a serial way on the main thread.

04:14 So you got to kick that kind of stuff off the background threads or things like Celery.

04:18 And this is a really cool way to do it.

04:19 I know that there's Celery and other things, but having some simple way to just ease into multi-process programming, and it's really hardly any code at all.

04:28 Right.

04:29 There's no extra service.

04:30 It just runs in process.

04:31 It's simple and easy.

04:32 Yeah.

04:33 Last up from Kenneth, although I'm sure I'm missing something that he's been doing recently, is setup.py for humans.

04:40 And this isn't something you run.

04:42 It's just he's got a repo that's an example setup file, which he directly offered.

04:49 This repo exists to provide an example setup.py file that can be used to bootstrap your next Python project.

04:56 It includes some advanced patterns and best practices, as well as some commented out nice to haves.

05:02 And it had a quick look through it, and it looks actually, I like it.

05:06 Yeah.

05:07 So get out there and make that module package, right?

05:08 Very, very cool.

05:09 Okay.

05:10 down or we're going to have to have another podcast just to talk about your stuff.

05:15 And he has his own podcast, which is pretty long form.

05:18 So maybe he covers this stuff there as well.

05:20 Yeah, maybe.

05:21 I'm not sure.

05:22 But yeah, definitely.

05:23 All right.

05:24 So up next is a really positive thing, but it sounds kind of negative.

05:28 I want to talk about the Python death clock.

05:32 So I'm over here on Python clock.org.

05:37 And it says Python two seven will retire in two years, seven months, five days, seven hours, 33 minutes and 35 seconds.

05:45 So that's that's pretty neat, right?

05:47 So here's this clock, there's just a running animated countdown to the 2020 timeframe, when Python two seven is going to be no longer maintained when it goes out of support and things like that.

06:00 Yeah.

06:01 So this is the get it's counting to what a best guess for when PyCon in 2020 is.

06:06 Yeah.

06:07 And there's no when they said they're going to retire Python to seven, they didn't say, we're going to retire it on June 1 2020.

06:14 Or we're going to retire on December 31 2020.

06:18 It's just, you know, within that year, kind of.

06:21 So there's a couple interesting things here.

06:22 This guy's like, alright, so when would be the ideal date to retire this?

06:26 It would be PyCon 2020.

06:27 Of course.

06:29 So he says, I hereby suggest we make PyCon 2020, the official end of life date, and we throw a massive party to celebrate all the Python two is done for us.

06:38 Python two, thank you for your years of faithful service Python three, your time is now.

06:43 Sorry.

06:44 So, yeah, I think this is a really cool idea to sort of encourage people to move from legacy Python over to modern Python.

06:55 And it's fun to just, you know, have up if you're when you're leaving your desktop open going to have some coffee, you can just remind everybody around you that Python 2 is dying.

07:06 That's right.

07:07 Or if your non-technical manager says, "We can't really afford to upgrade that old Python 2 code," you can say, "Well, here's the Python 2 death clock.

07:15 So this is our time frame.

07:17 This is an upper bound from when we should get to this." So this other one that you want to talk about is pretty interesting.

07:23 It's kind of a design pattern, almost a pushback on some of the more intense design patterns, I would say.

07:29 So one of the things that I always push, I don't always, but my red flag goes up whenever anybody follows something dogmatically.

07:40 Like just, this is a best practice, follow it or else.

07:42 I don't like that.

07:44 This is an article called "Small Functions Considered Harmful" and it just takes a look at, there's a quote from here, "General programming advice doled out invariably seems to extol the elegance and efficacy of small functions. And I have seen that like this the author has to an extreme where sometimes people will go to the point where they're writing very small functions like one line functions and that and I think that's okay for some cases like complicated math maybe it makes sense but small functions that are only used in one place it actually doesn't help and so there's she goes through and talks about quite a few problems with small functions, including just making your--

08:30 there's a lot of things that she talks about.

08:32 But I think it just makes it code harder to read, to me, and especially to newcomers.

08:37 One thing I didn't think about was if you're using classes a lot, adding more class functions just kind of litters up your class namespace, your interface.

08:48 So it's harder to tell what the class is supposed to be doing.

08:51 Yeah, I mean, you almost got to go to the level of using double underscores to make that stuff not show up, right?

08:58 - Yeah.

08:58 - Right, so it sort of hide it.

08:59 So, okay, these are the internal things.

09:00 These are little stuff I broke it into.

09:02 I have mixed feelings about this.

09:04 I am sympathetic to what Cindy says.

09:07 I feel like she has a really good point.

09:09 And certainly some of these like dry principles, some of the design patterns taken too much to an extreme are really painful.

09:19 Like I would say one of the hardest applications I've ever worked on is this like 50 to 100,000 lines of code that was just fully abstract everything design pattern this dependency injection that and just every time I wanted to do something like where does this live?

09:39 How can I tell what it does?

09:41 I know like somehow it's assembled at runtime.

09:43 So this thing happens, but like there's so many pieces and patterns contributing to it, it was really, really not good.

09:49 And I think that's what she's kind of riffing on.

09:52 But I also think there's, it doesn't hurt to necessarily encourage people to write small functions.

09:59 But if they get too small, it is certainly a problem.

10:00 My rule of thumb that I use is, does the function need documentation to tell what it does?

10:07 If it does, it's probably wrong.

10:09 Now that that doesn't necessarily apply to like, it's an API in a public package, and you've never seen it.

10:15 Right.

10:16 But in your own code, like do you need comments to tell you what that function does?

10:19 Or does a short simple name tell you what it does?

10:23 I feel like anytime I'm about to write a comment, and Martin Fowler, I think it's Martin Fowler, has a really interesting way of talking about comments.

10:29 He says, "Comments are deodorant for bad code." I feel like if I'm about to write a comment about a function, I'm like, "Oh, this probably just should be rewritten." It's really clear what it does.

10:40 It's certainly attention, but I guess maybe the warning is don't take it too much to the extreme.

10:45 It makes it at least as bad or as bad.

10:48 I want to touch on one more thing because I've been thinking about agile and agility a lot lately, especially with refactoring code and one of the comments she brings up is that breaking up your code into small pieces Can create premature abstractions So you're breaking it up into multiple pieces and that makes it harder to it might make it harder to refactor Once you completely understand the problem space So I think the time to break up things is after you've completely, mostly solved the problem and you're just making it maintainable for the future.

11:25 - Yeah, that's an interesting point.

11:26 Like once you fully understand and have solved the problem, like apply some refactoring tooling or concepts against it.

11:32 And then it's much more likely to be stable and you've got the big picture and then you break it up.

11:36 Sure, I agree.

11:37 Nice.

11:39 You know what I've been thinking about lately?

11:40 - What?

11:41 - Datadog.

11:42 - Oh yeah.

11:43 - Yeah, so Datadog, they're sponsoring this episode.

11:44 Thank you guys.

11:45 What they do is basically they let you have an entire view of your entire system, not just your application.

11:53 You've got your Python code, but maybe your Python code is running on a web server, it's built on Flask, it's talking to MongoDB, it's hosted on a set of scaled out Ubuntu servers or on the Nginx and microWSGI.

12:04 You can actually integrate Datadog into all those things that I've mentioned and get an an entire view of how your overall system, those things all taken as a whole work, not just logs or performance monitoring for your Python app, which is pretty awesome if you have a big distributed system.

12:21 >> Yeah.

12:21 >> Yeah. So they actually have a cool little tutorial you can take at pythonbytes.fm/datadog, and it takes just a few minutes and they'll even send you a cool Datadog T-shirt if you do the tutorial.

12:32 So check it out at pythonbytes.fm/datadog.

12:35 It helps support the show. Yeah.

12:37 Yeah, if I do the tutorial, can I get a t-shirt even?

12:40 You can get a t-shirt.

12:41 I don't think you've been excluded.

12:42 Okay, great.

12:43 Awesome.

12:44 Yeah, we could both go get a t-shirt.

12:45 Awesome.

12:46 So, we talked about the death clock a little bit.

12:48 Let's talk about more sugar, less of a stick type of a thing to encourage people to use modern Python.

12:55 I ran across this site.

12:56 I can't remember where I found it, but it's really cool.

12:58 It's called yPython3.

13:01 And what it is, is if you pull it up, there's a simple little code sample of some Python three feature that's awesome that you can't use.

13:08 There's a button like, "Show me another cool feature," and it'll randomly generate another code sample of something that you could do.

13:15 I hit it a few...

13:16 Isn't that cool?

13:17 It's really simple and quick.

13:18 I hit it a few times, I got annotations, so type annotations like functions say it takes two integers and returns a string or something like that.

13:26 Keyword only arguments, which is pretty cool.

13:30 a way to say like you're only allow, you can basically say like you must pass these certain arguments as keywords, which was not a thing in Python 2.

13:38 Yield from for basically consuming generators and turning them into generators.

13:43 Enums and a bunch more.

13:45 You can sit there and keep clicking, give me another random sample.

13:48 It's fun, right?

13:49 - That is nice.

13:50 - Yeah, cool.

13:50 So just go play around with that.

13:51 Actually, there was a few things that I learned about that I didn't know like the secrets.

13:55 I just have no reason to really play with the cryptographic secret stuff, but that's apparently new in Python 3 and pretty nice.

14:00 - Yeah.

14:01 - So let's talk about something a little above the code, but something happens a lot in technical spaces.

14:07 - Yeah. - Drinking.

14:08 - Drinking, definitely.

14:09 And speaking of secrets as well, there's a secret that is not so much a secret that not everybody drinks alcohol.

14:17 So I actually got, I thought about this a lot because Trey Hunter brought it up recently on Twitter.

14:22 And he said that a lot of the conferences and tech events that he goes to, He and I quote him. I feel I sometimes feel excluded when events include nice alcohol, but cheap soda And I've never really thought about that before and I want everybody else to think about it. And so there's this Acronym called ENAB e a n a b which is equally attractive non-alcoholic beverage And I think it's a cool idea so there's a tray also linked to us to got us on to a Stanford site because There is like an alcohol dot Stanford site, which is cool ENABs are required for all Stanford parties and it's a it's a cool idea So if you're gonna have like like let's say we have a get-together and you got like some specialty beers we'll go out and try to find some specialty local sodas also or make sure that you have a nice if you got a spiked punch make a non-alcoholic version and Then the Stanford site also has quite a few mocktail recipes that look easy and delicious Yeah, that's cool. And it those are pretty easy to do right like here in Portland I know we have a bunch of like locally brewed root beers, for example and things like that. Yeah. So yeah, hot lip sodas Yeah, yeah hot lip sodas. Those are really nice and not alcoholic unless you spike them and I think most events now think about having non-alcoholic stuff too, but it's the equally attractive part of Make sure that you're not getting cheap stuff. If you're going all out on the alcohols you could have either that really cool minty cocktail or RC Cola.

15:56 - Yeah, and if you're in the Portland area and you are serving cocktails, let me know and I'll show up.

16:01 - Yeah, yeah, exactly.

16:02 I'll be there with you guys.

16:03 - Yeah. - Awesome.

16:04 So there's probably a theme, I don't know, maybe I was just in a particular mood today or something 'cause I've kind of chosen related type of topics.

16:12 But we've touched a few times on the popularity of Python.

16:16 And I keep coming back to this, not just to like be a cheerleader and rah, rah, rah, things are great.

16:21 But you know, people bet their careers, at least short term, on studying certain technologies and pursuing one thing over the other, show Node.js over Python and web apps, or something like this, right?

16:33 So there's a really interesting article from Stack Overflow, and Stack Overflow, I think, is killing it in terms of deep insight into the developer community.

16:42 And the title is not so bad here, it's "The Incredible Growth of Python." How about that?

16:47 - Yeah, this is actually a fascinating article, so I'm glad that you brought it up.

16:50 Yeah, so I just, it came out today, like just a few hours ago, I'm like, we have to cover this today.

16:55 So the idea is they recently wrote it, this is not this article, previously, they wrote an article exploring how wealthy countries, those that are defined by high as high income countries by the World Bank, tend to visit a slightly different set of technologies than the counterpart of developers in the world.

17:14 And they said, well, if we actually look at that set, the largest difference we saw was among Python programmers and the Python programming language.

17:23 And in high countries, Python is even more popular, more extreme in its popularity than things like Stack Overflow trends, Google trends, and other language rankings would make it out to be.

17:36 So they basically said, in this article, we're going to make a case that Python has a solid claim to being the fastest growing major programming language, period.

17:45 Yeah, so did you look through some of the graphs in there?

17:48 Yeah, well, the one that I didn't understand, hoping you can explain to me, is the predicting future growth looks like an even larger gap between Python and everything else.

17:57 - Yeah, yeah, so they started out by saying in June 2017 was the first month that Python was the most visited tag on Stack Overflow, period.

18:07 That's, of course, all those conversations restricted to these high-income nations, right?

18:12 US, Europe, Canada, Australia, those types of places.

18:17 But if you restrict your attention to those areas, Python is by far the most visited.

18:23 It's actually grown two and a half times in popularity since 2012.

18:28 And there's one that compares it to, there's a graph called Python compared to smaller growing technologies.

18:36 But what was the first one?

18:37 You asked me about which one?

18:38 - Looking at future growth.

18:39 - Oh, right, right.

18:40 The prediction of the future growth.

18:41 So they said, look, if we're gonna look at these graphs over from 2012 until now.

18:47 And then the guy who wrote this article is actually a data scientist.

18:51 And he said he used to do a little Python, but he only does R, so he doesn't really have much of a horse in this race.

18:56 But he said, "Let's apply statistical modeling "to the growth curve out to 2020." And if you look at that, it's just like crazy.

19:05 So they say, "Well, maybe there's gonna be a back and forth "with Java as students go back to school this month, "and they're gonna look up issues for their homework, because Java's taught a lot of the first year of computer science, said, but if you follow this trend, it's like, it's domination.

19:19 It's basically what he said.

19:21 There's another one that's really interesting 'cause I feel like people compare this a lot.

19:25 It says Python compared to smaller growing technologies.

19:27 So Python often gets compared to things like Go and Rust in the data science world, it gets compared to R and so on.

19:34 And there's a graph showing it just like 10, 20 times more popular and steeper growth curves than all of those languages, which I think is really interesting because people, people kind of see these shiny new languages and go, oh my gosh, this is, I should just abandon Python and go write Go or whatever.

19:52 And that may be true for some particular case, but not in general.

19:56 - Yeah, and some of the strong languages that we have been around for a while, like PHP, C++, Java, it's interesting to see that those charts are, they've been relatively, either relatively flat or slightly declining for the last few years.

20:14 - Yeah, a lot of the standard well-known ones, the ones you named, right?

20:18 They are definitely slowly, slowly trending down, which is not amazing for them.

20:22 Yeah, so also related, there's another article.

20:24 I almost covered this one, but in fact, this one was just so neat and had so much data behind it that I thought I'd rather cover this.

20:32 But there's another one that says, "Python overtakes R to become the leader "in data science and machine learning platforms." So these are, of course, related.

20:39 So I linked to that one in there as well.

20:41 - Yeah, finally, one wrap up is this was applied to high-income countries.

20:44 If you apply it to countries that are not in that group, they said Python has the exact same growth curve, it's just it's starting at a lower point.

20:53 So they expect in the future, in a few years, that to also be able to make these kind of statements there, but there's like a lag, and they talk a little bit about that.

21:00 It's kind of interesting.

21:00 - Yeah, I'll have to go back and read those other article because I don't understand why the difference between different countries.

21:06 - I didn't get a good, solid answer there either.

21:09 - Okay, cool.

21:10 but definitely worth checking out.

21:12 - Hey, that's our six, man.

21:13 So-- - That is our six.

21:15 - That was fun.

21:16 Well, what's up with you?

21:16 What's, any news?

21:18 - Well, I've been doing a couple things.

21:20 I've been learning the joyful bit of the decay of online courses and been rerecording some of my online courses, sections of them as the web properties they depended upon, like web services or something, changed their model or went away.

21:35 So that was fun.

21:36 (both laughing)

21:39 But it's all good to be able to keep that stuff fresh.

21:41 Also, I'm going to Pi Cascades.

21:44 So this is a new PiCon in Vancouver, British Columbia, beautiful place in the world, in January 2018.

21:51 So I already booked my flight, and I'm trying to get you to go, and you're on the fence, man.

21:55 - Yeah, I really wanna go.

21:57 I don't know what my January's gonna look like yet, but I should decide soon so I can get a flight.

22:01 - Yeah, you definitely should.

22:03 Awesome, how about you?

22:04 What else is new?

22:05 - Well, I just got back from Germany, And one of the things I did there was I met up with the--

22:12 I want to shout out to everybody at the Munich Python user group that, like, less than a week's notice decided to come together and hang out with me for an evening, which is totally awesome.

22:23 And it was a lot of fun.

22:24 We talked about pytest, of course, but we talked about quite a few other things as well.

22:28 Yeah.

22:28 That's awesome they were able to put that together on short notice for you.

22:31 Yeah.

22:31 And then something happened just today, and I didn't even know it was going to happen.

22:35 So the pytest book I'm now no longer working on.

22:38 The last beta was beta 5, but beta 6 just came out today, which is the...

22:43 I wasn't involved at all, but it's all the copy editing changes.

22:47 They fixed all my typos.

22:48 Oh, nice.

22:49 So this stuff has been pushed off to the editors and they're rolling it back out to the readers, huh?

22:54 Yeah.

22:55 And so it's just a...

22:56 There's some magic machine now that turns it into a book, a physical book.

23:00 So that's...

23:01 Does your book have a version number?

23:02 Like 1.3, 0.7, 0.6?

23:05 No.

23:06 It should.

23:07 Well, I mean, it's all of it's stored in revision control.

23:11 So it has versions that way.

23:13 But yeah, just as a shot really long, hard to make any sense of.

23:16 Awesome.

23:17 All right.

23:18 Well, it's great to be back together with you, Brian.

23:19 I think we're both gonna be relatively stable for next few episodes, probably.

23:23 So that'll be good.

23:24 Yeah, definitely.

23:25 So thanks a lot.

23:27 Thank you for listening to Python bites.

23:29 Follow the show on Twitter via at Python bites.

23:31 That's Python bites as in b y t e s.

23:34 get the full show notes at PythonBytes.fm.

23:38 If you have a news item you want featured, just visit PythonBytes.fm and send it our way.

23:42 We're always on the lookout for sharing something cool.

23:45 On behalf of myself and Brian Okken, this is Michael Kennedy.

23:48 Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page