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

« Return to show page

Transcript for Episode #190:
You will now be notified if the Python zipper is broken

Recorded on Wednesday, Jul 8, 2020.

00:00 Hello, and welcome to Python bytes where we delivered Python news and headlines directly to your earbuds. This is Episode 190. Recorded July 8 2020. At least it's the eighth here. I'm not sure what it is in Australia. Is it tomorrow already? It's not. Oh my god, you're from the future. Anthony Shaw is here, and he is from the future. That's awesome. I'm Michael, as everyone knows. And Anthony, thank you for joining the two of us here on the show. Happy to have you. Yeah, I'm glad to be here. I want to kick this off with a thing, an interesting article. It's by Tom Christie titled Python async frameworks beyond developer tribalism, in I think it's a tom Christie if you don't know who he is, he's done some things like the Django rest framework and HTTP x. Of course, other people are on those projects as well. But bright guy, and I think it's important to reaction we didn't cover this article, but we noticed it prior article called async. Python is not faster. But all of us had some issues with the article itself. And so this isn't a direct rebuttal. But it's a it's an interesting read. One of the things Thomas, Tom Christie's pointing out is just that take that we need to move the Python community beyond polarizing discussions. And I think that async Python is not fast or was not a helpful discussion. But it's part of it anyway, a little bit of a quote, we could probably benefit from a bit more recognition of where there is shared ground, in in the areas where there's less clarity, have constructive conversations around those. And so some of the shared ground, Tom points out is kind of one of the things is you really shouldn't really care about performance too much when you start a project, the success of a project is more related to developer experience, and the strengths surrounding the ecosystem of the framework you're using, not just whether or not it's faster, and you should care. But we as the Python community do need to care about web performance, partly because new projects starting off, might decide to go with non Python solution, because they fear Python might be too slow. And and how often have either of you heard Oh, we decided to rewrite that and go, so we have proper async? Or we decided to use JavaScript here? Because it supports async through node or something like that. Like I've heard that a lot. Yeah, definitely. Lots of projects. Yeah. And I'm not sure. I don't know anything about those other languages, though. So at least I haven't used them. But for me, it would be a mistake, because I know Python. I don't know those other ones. Okay, so that's one of the points is that maybe we should care a little bit. But also, we should be careful about the word performance. Because if you measure performance of just a single async function calls with a single function call an async call is going to be slightly slower, because there's a little bit of async overhead. But we don't use async. Because we want single threaded applications to be faster. We use it because especially IO bound concurrent tasks are they scale better with a sink. The other aspect I wanted to talk about was a, there's just really, you have to be careful with looking at benchmark data, because benchmarks are often geared to select it to tell the story that the person writing the article wants to convey or the situation that they're trying to solve, right. They're like, Oh, I thought this would help I tried to solve with this turns out it doesn't. It must be bad. Yeah. Right. Okay. So there's some things that they're just reasonable statements. And there are some valid differences, like, for instance, as should web, the web frameworks we have now, should they start converting to async? Or should we just leave them as they are and develop new frameworks that are async? native? Those are some differences. There's also different approaches, which is part of the confusion and part of the discussion is, there's a saying a guy, oh, there's also trio and twisted and Curio, and you know how to decide which one, there is some confusion there. And I think that's valid. So the discourse in the discussion is important. But I think it's important, Tom points out to say, basically, we need to keep it. The benefits of adopting genuine collaborative mindset are good, rather than a competitive mindset. So let's not fight with each other. There may be different, or everybody's working on different little corners of the landscape. But we're still trying to appreciate move the move async and move web forward for Python. So stay positive, be happy.

04:36 The happy man? Well, I didn't want to just call this other article out and criticize it because I don't think that adds a lot of value. I don't think we want to cover items just to criticize them except for their their rare moments where it's getting a ton of attention. And if you think there's an inaccuracy, you probably should call it I'm glad Tom wrote this article. I think Tom wrote it right. I mean, it's not attribute ID but it's from basically his organization. So

05:00 Pretty sure, yeah, I had to go look at the GitHub repo to see who did the push the commits for this article. So yep, it was time. What an interesting way to attribute it. Very cool. I honestly believe that other article which you're linking to, is inaccurate. I think it's trying to apply a sink to a situation where it's not very warranted. It's like, this hammer is really bad at unscrewing this nail, or this unscrewing the screw. hammers are bad, right? Well, hammers aren't for that async stuff is for scaling. When there's a waiting period, when you're there's a latency when you're waiting on something. And the setup there was, the DB was 100% maxed out. So there is no way to like push that waiting and get more out of the database. And there was almost no waiting like, a few milliseconds anyway. And so the overhead didn't make any sense. Somebody wrote me and said, Michael, please, I don't know your thoughts on this. So I went ahead and did a little quick test, I've got my async course I've got some stuff where we go and talk to things on the internet, where there's like ping time, latency and stuff. And it goes and gets 10 items off a web server ping times, like 100 milliseconds or something. It was 750% faster to use the async version than not the async version. I changed that number to get 100 of them. And it went from 50 seconds, almost one minute down to two and a half seconds. 1,750% faster. async is about scaling the waiting part. If there's no waiting, there's no benefit. There's just overhead. The one thing I have to guess I'm gonna be on the other side a little bit. The async is not fast article, one of the things he did point out was a lot of the async. framework benchmarks are in the benchmark numbers are not really that fair, because they're, there's other ways you can speed up the other platforms by for instance, adding processors or CPUs, adding more cores to to different applications. And that may be that the original application was just misconfigured. I think that's valid, but it doesn't mean that you think is bad. Yeah, it definitely adds some complexity. Go ahead. And if you're comparing it with multi threading, I think that's the comparison. I think if you're just looking at, I've got single sequential code, does adding async make it faster? If it's something that's IO bound, yes, is the answer. But if you're comparing it to multi threading, so using the threading module to to spawn threads, then I think that's where you see the performance improvement. So I've got some, like micro benchmarks, doing a TCP port scanning across all the different ways you can do concurrency and parallelism in Python. And async was the fastest of those all those options. And it cuts down a lot of the overhead from threading because the way that the threads work in, in Python, they're kind of got this bootstrap module that kind of has to load some of the stuff that our needs for context. And whereas async doesn't need that. So it kind of cuts down a lot of that overhead. I think one of the challenges I've had with async. In the earlier versions, where it got released was the amount of boilerplate code and kind of infrastructure you needed to put in just to do something really simple, which is like, I want to run this function asynchronously. Like I don't care about what how the event loops and all that kind of stuff. Like I've used other languages, I want to kick it off and forget it. It's like why can I just call this function and let it go? What is all this stuff I'm doing? Yeah, exactly. So like I've used other languages, whether the async is a bit more fluent, like it's, I've been using the kotlin in async. Last weekend, and I've used dotnet. So C sharp, the task API, which is really, really nice to use. The other challenge is who which bit of code owns the event loop. And that's like an anti pattern where you end up with, you know, like a god class, just kind of doing everything. And you've kind of then got to think about how you factor the application. So that, okay, which bit owns the event loop? How do I construct that? Where does it end? We were held on the real Python community groups, somebody was asking some questions said async. io is a multi threading into their code. And we were just trying to get them to refactor it to take all the logic out of the function that was being multi threaded, and put it into the master. And just put the minimal amount of code in the threaded function. I think there's still a whole bunch of stuff like that, which people need some good learning on and they need to get used to it's like a different way of writing code. It's not just something that you can sprinkle on top, and it suddenly makes your code faster. I think that's the that's part of the misunderstanding. Yeah, especially in Python, where it takes that extra step of you got to manage the loop, and then you've got to run it. And it's not like kind of kicked off a bunch of stuff. And now it's all just happening. Yeah, they made that simpler in three, seven and three, eight. They've kind of got some shortcut modules that so I think it's now like one or two lines of extra code you need as boilerplate just to get async is up and running is a lot better than it was in earlier versions, but even if it's not a lot of extra code, and Tom Christie points this out. multi threading and async are more complex.

10:00 And then not. So that's just a reality whether or not the codes more, too much more complicated, the entire design is different. And it's a reality that isn't to say, don't do async or don't do multi threading. It's just, you don't get it for free. I think almost the opposite. In a sense, I think the code is not complicated enough. On the other hand, like it looks close enough that people don't realize they have to change their mindset and like approach it in an entirely different way. And they feel like oh, I just call it this way now. But then they run into these issues. They're like, Oh, this is broken, like, why it's not working or you know, like, you think you can just do it one way. But you really, if you don't have a little deeper understanding, you can just go down the wrong path also. Yeah. All right. Well, that was interesting. Thanks for bringing that up. And Thanks, Tom, for writing that. And I'm glad you're here to have another opinion as well. I agree that the C sharp async await stuff is it's like the gold standard. It's really, really well done. So but let's talk about something way simpler. You want to be a good citizen of your GitHub projects, right? Sure. Obviously, you want to have good commit messages, there's a major change, you want to bump the version, all those kinds of things, right. So you should use commit isn't committed in is a command line interface. Basically, that wraps around get, but it has like a menu option for different things. And it guides you through doing them a little bit better. So like, you can say Cz, and it'll drop down a list. You can pick commit or whatever. And then it'll ask you questions like, Okay, well, what are you trying to do? Are you trying to add a feature? Are you trying to do a bug fix? Or is it a PR, it'll ask you a couple of questions. And it'll generate interesting things like, Hey, is this a breaking change? Would you like me to increment the major version, as part of this, and so on. So it does all sorts of interesting things around kind of structuring your interaction with git, so rules for projects, auto bumping versions, auto change, log generation, all that kind of stuff. And it's really meant for teams, so they all like interact with Git in a consistent way. This is cool. That's Yeah, right. Yeah, if you go to it, it has a beautiful animated GIF, showing how it works right on the GitHub repo. I love that. So do you. I'm just curious, do you normally commit through command line or through something else? No, I commit, either through pi charm or source tree, depending on what I'm doing. Yeah, I do both. Yeah, if I'm in, if I'm in PI chime in a project, I'll get to that. If I'm doing something else. So like, sometimes it's like killer hacks or scripts and stuff like that, then I'll do on the command line, or like a presentation that's in, say, PowerPoint or something. Yeah, yeah, I'm committing my PowerPoint presentation. And

12:43 then I'd use the command line, but I've got a bunch of aliases to do cuz you too, there was sign your commits and stuff like that. So there's some aliases, and something else would be really helpful. A lot of people don't know is that you know how if you do git commit on the command line, it uses vim as the message editor. By default, you can actually change that. So if you wanted to use another editor, like Emacs or notepad plus plus, or maybe even Microsoft Word, then you can change the configuration. And in the command line, you never have to use vim ever again.

13:15 I think a great prank that people have said all do, hey, don't maybe not all sneak into your coworkers computer if they run away for lunch, and don't lock it and set word as the editor. So next time you go to do something, and there's a merge error, like it pops up word you like why did the world is going on here, but your commit messages are gonna be like 10,000 lines of XML.

13:38 Exactly, exactly. Now, that's cool. This thing this committed and also comes with a get pre commit hook. So you can set it up there as well. And you can ask it for things like you just say, a run the bump, or generate the change log or validate the schema of a message or whatever. So pretty cool. It generates a change log, like I've been looking for something to do that for ages. Like I've got projects in git, and when I make a release, I had to like remember what got merged, which prs got merged? Who did them so you could attribute them and I don't know what the output is. But it says, you know, Cz, space change log, or ch for the short. shortness is what it will do. And it says generates change log by overwriting an existing file, if it's already there. I don't know what how it knows how far back to go. Maybe from like a, like a major version bump or something like that. But anyway, give it a try. And then give us a report. We'll find out if it's actually useful for you. Alright, well, that's it for commit isn't it seems like a cool little shortcut. I don't know if I'll use it or not, because I don't work in large teams that really need this very much. So it's just like one more thing, but if I did, it would be cool. Next up, I've got around Python. What are we supposed to meet at pi con and beer the three of us and like, no, didn't happen. It didn't happen. It was touching go

15:00 As well, like I remember a few weeks before, and whether or not was going to happen. I mean, it think canceling, it was definitely the right decision. Oh, and it wasn't really canceled. I mean, it was moved online. And that's what I wanted to talk about was, you know, with all the PI cons happening all around the world, like I've been looking at which ones have made the move to go online. I mean, there's, I guess there's like pros and cons to this. I know, some people miss out on meeting people and chatting to people in the hallway track. And like, you're never gonna replace that with an online conference. And I think, set your expectations low when it comes to interaction with other people. But the one big upside is that, it really, I think it makes the talks more accessible. So if I go to a big pie con, I probably saw watch, maybe like 10 talks over the pie con. And there's probably like 100, that I could have watched if I just sat in the talk rooms. But like that's not half the reason on there is not to watch the talks, like I watch a lot of them afterwards. So I think what's been happening is quite a few pipelines have just cancelled altogether, pi con Israel, Odessa and Ukraine, Euro sy pi, Brazil, piko, and UK pike on Thailand, Python, Spain, Dragon pi, which is Slovenia pilot, I'm Python, D which is Germany and Python c Zed, which I assume is the Czech Republic, they've all been cancelled altogether. And then a number of Python conferences have said we're going to go online. And the cool thing about these is that anywhere in the world, you can go and watch the talks. And I think something that's kind of happened as part of this is that some of the big pie cons like us and like euro pie, they had like video crews to film the talks. And like, you know, write all the subtitles and figure out how all the AV to get the sound nice and stuff like that. But other than that, the really big conferences, the smaller ones couldn't really figure that out. So some of them had to talk online. But like the quality was really not watchable. But a big change with moving all the talks online is that people are recording at home, in lockdown. And the quality tends to be a lot better. Like you can you can hear what they're saying. And audio is better. And and, and so there's more focus on getting the online experience better. And as an added bonus, just as a Python and Python enthusiast even or a Python a theist, you can just sit and watch Python talks from all over the world, in your slippers, or in your boots if you're in.

17:36 And it's great like I, you know, beam it onto the TV using Google Chromecast. And you can just sit in your living room and watch like Python talks from us watching something Japan. So from, like, some of the US conferences, some of the European conferences, and this is really good talks, that would have made great talks, you know, the bigger conferences that are in the smaller regional ones that are in there. So some of the ones that I found, which are online, click on us, obviously, the Python web conference, fast con sy pi and pi HTTP, which is high energy physics, I think will be online euro Python will be online, pi Khan, Japan. They released a whole bunch of talks this week pi quite a you will be online. And I've submitted a talk for that Fingers crossed Python, Bolivia will be online, like on Saturday, which is South Africa will be online pike on APAC in Malaysia will be online, Hong Kong pie Bay, which is in the US and California and pikelet. Africa will all be online. So there's at least from what I could find at least 15 pi cons around the world. So let's say each one has like 50 talks, that's like a lot of talks, has a ton of talks. And you can just drop into some of these places that you might have a really hard time visiting, like, maybe Malaysia is far away, or Africa is far away. But you would love to experience what the community is like there. Yeah, a lot of great stuff. There are actually a few icons, that from what I can tell are happening in person around the world. I guess the lockdown situation is very different depending on the country. So Python, Taiwan, Python, Talia, and pike and Russia from what I can tell are still happening. So yeah, I know the situation in Taiwan is much better. Italy, I think is late in the year so they're probably hoping that was going to calm down and Russia. I don't know what's going on there. But I picked out a few talks as well that I really liked from some of the regional conferences to set up security using Python by Khagendra Desh Pandey. if statements are a code smell by Ollie from chippy. That was the Python us talk stop using mocks by Harry First of all, that's a great talk. This one is in Japanese, and there are no subtitles, but if you speak Japanese network analysis and text pep in analysis, which is like an hour

20:00 Analysis of all the peps by smoker Faruqi using Python to detect vulnerabilities in binary is by Toyota. That was a good talk and optimized Python and Django with Postgres superpowers by Louise grown yonk, which was a Python us talk. So yeah, I've made a little playlist of stuff that I really enjoyed from some of the regional conferences. And the links will be in the show notes. Now, these are all great. Yeah. Love it. And you talked about the smaller conferences, not necessarily having the AV setup, put things online properly. You know, all these talks that went online, they were made digitally native, right? They were made first for this experience, right? They weren't like, oh, there's a camera way back there. And we'll just zoom in, and we'll try to show it right. It was like yours. You had sort of an introduction. That was like the video we got here. You come back and talking, then it would just focus in on the screen, and whatnot. So a little bit different there. Yeah, definitely. And you should definitely watch Brian's talk

20:59 from find us. I did watch your talk, Brian. And you should watch mine as well, if you're interested, which is why it's Python Sloan binds was on premise. It was on testing, wasn't it? Brian parameterize. Testing

21:11 parameterize this a little as it gets? I was surprised to hear my name mentioned in Harry's talk, which is surprising. Oh, yeah.

21:19 That's cool. Yeah, very nice. And it's, you know, it's a bummer to not go to these conferences, but at the same time, there are a bunch of people who now can experience those presentations who otherwise wouldn't have been able to Yeah, this is a huge benefit. And I'm really excited to see, like I said, there's conferences that either had bad video or just couldn't afford a great AV crew, or didn't, and some of the conferences will just do like, the entire day video. And you have to pick it out. And that's more hours and 17 minutes into it. Okay. Yeah, sure. Well, I'm really excited to be able to see all these videos from all over, although I won't be able to I only speak English. So how many languages do you speak at me? Oh, I'm learning Japanese. So I was watching the pike on JP talk and catching every 10th word. Okay. And the slides definitely help. And I speak Pidgin French as well. Okay. Yeah, I was impressed that you're watching the Japanese videos. That's how I discovered that your Python testing with PI test book in Japanese. It was like part of the it was on the slide was like a it was it just said lots of stuff on the cover in Japanese and they just saw the word bride. Okay. I was like, oh, that okay.

22:32 Yeah, I gotta try to get somebody that travels to Japan, when things open up to pick up a copy for me. Yeah, definitely. Yeah, it's cool. Also, cool. Speaking of your book, people want to support the show, they could get your book. Yeah, that'd be great. I wanted to do something special. I was looking at the reviews online on Amazon. But I know there's reviews other places. But this was really kind of cool. I'm gonna do an expert excerpt from Patrick Kennedy's review. This book provides a gentle introduction to what the PI test framework is, how to use it, and how to develop tests using pi test. I had never understood what fixtures and pi tests were prior to this book. But now they make complete sense to me. excellent book, and I highly recommend it to anyone wanting to learn about pi test. So thanks, Patrick. That's a cool review. And I went looked at the numbers. There's thousands of people that have read the book. And I know many of the listeners have. So I would love to hear more reviews. So if you have a review somewhere either on Amazon or Goodreads or somewhere else, let me know where the review is. And I'd love to hear what you think. That'd be cool. Awesome. I think the timing for this will still work out fairly. Some of our courses are offered in the Humble Bundle right now. So there's a special Python Humble Bundle going on. This episode will be out in a week. So it should be wrapping up. But it should still be going if you listen to soon enough, I think it ends July 22. So before then, if you want to get a whole bunch of Python goodies, including three courses from talk Python, go there and check it out. And of course, check out all of our courses as well. You get a lot of value even without the bundle. So yeah, for sure. Thanks. You know what, what happens if you try to zip stuff together as an eternal zip? And they don't match just like the zipper stick at the end? Does it go all the way to the end? And then come off? Like is it when your sleeping bag comes apart in the middle and like I'm gonna be really cold tonight. I can fix this. What happens? Whatever doesn't fit just gets cut off. So brutal.

22:32 Yeah, so I wanted to highlight Pep 618. So I have actually run into this a lot. So in the normal circumstances, so zips a cool thing. If you haven't, I'm sure everybody's used it. If you haven't used it before, it just takes to two intervals or more more than one, it's often two In my case, but you can do more than two intervals, and then makes a new iterable with pairwise tuples of whatever's in there. So, if you've got a list with 123, and ABC and another list, you can zip them up in your element.

22:32 Have a new list will be one a two B, three C, that sort of thing. So often they're used where you just you just kind of know that all the links are supposed to be the same, because if they're not the same chops a month it does it, you get a list of the shortest, the shortest common list. And that's surprising. And sometimes it might be okay. But it's probably indicative of like, bad data. And who knows if it's off by the end or off by the beginning, or they shouldn't go together? Like, it's not a good sign when I'm using it. And it's a kind of a mission critical sort of thing. I'm definitely checking the links first, and it annoys me that I have to. So the change is in Pep 618. It's not? No, it has been accepted for 310. So it will go into Python 310. And the changes really, there's a new keyword. So in zip, you can add strict equals true. And that will, if they're all the links are not the same, it'll raise evaluator. So you'll get an exception if the links are not the same. So you can just instead, I think it's a good thing. It'll simplify a lot of my code. Yeah, Anthony, what do you think I've never used it, I only use it in the offset. So Stack Overflow question. Well, that's the solution. And I copy and paste it into my code. Normally about like, how do I merge two dictionaries? I think that's like, it's like, oh, you just do star star lists, Star stars, IP stars or something like that. Okay. I don't understand how that works. Yeah, Star Star may be more explicit.

22:32 So let's just stick it in and see if it works. Yeah, I never used up. So that sounds useful. I did stumble across 3.9 has a some new functions on the strings, remove suffix and remove press. Yeah, so we talked about that last time, which I don't think we've released. So you wouldn't know. But it's so confusing. Because string dot like if you have the word first, the number one than St. And you said strip St. It's not necessarily taken away the st. It will. But it might also take an SRT off the front as well. Right? It's take away all the characters that are in this list no matter what, not this exact. substring. Right. And so yeah, that's super valuable. I'm really excited to have that because it should have been there before, I think they should have come up with a more fun exception than a value error. Like it could derive from value error. But it should be like, you know, the zipper broke exception error or like, come on, opportunity missed. All right. Let's stick with the standard library. This was really interesting to me. I had Paul Ganzel on talk Python recently. I don't know if you guys have listened to it. So you might not be able to ask you the question without you actually knowing. But this always frustrated me when I go to a time delta, and do some math like subtracting one day time from another. I get it back. I'm like, cool. It has a certain number of seconds. It also has days, and other things on it as well. But those aren't like total days. It's not like 7.2 days, it's like eight days, and then some negative seconds or something weird, really weird, like negative and positive time. So those are more for like internal computation. far as I can tell, they probably should be hidden. But anyway, if I want to know say, how many hours has it been? How do I do that? I would go DT total seconds. Okay, well, there's 60 seconds. So I divide by 60. And I want to know are the minutes I want to know hours divided by 60? Again, and I never put it together, I don't divide by like 3600. I divide by 60 and then divide by 60. So it's clear. I'm trying to take away the you know, get two minutes and then two hours. Is there a better way? Right? Why is there not a total hours? A total weeks, a total months, whatever. on there? Like why do I have to always do math whenever I want to know simple things like how many hours have passed? Okay, well, okay, so the people who built a time or sorry, time delta specifically, they didn't intend you to do math, they just didn't make it obvious or very discoverable. Because time deltas can be divided by time deltas. So if I want to know how many hours it has been, I can say like take the total time delta and divided by time delta where hours equals one, or I want it blocks of six hours. I could divide it by hours equals six. If I want to know how many weeks I would take the total time delta and divided by time delta days equals seven and that'll tell me how many weeks Huh, that's pretty awesome. I had no idea that I had no idea either. And I was complaining to Paul Ganzel who works on this stuff like, dude, give us something more than seconds. Why are we only getting seconds? I went total hours I went total days. He's like just divided. Just set the days to be one and divide him like what? You can do that. Why didn't anybody tell anybody this? Anthony Did you know this? No, this is a podcast so you probably can see I had my head in my hands for that explanation.

22:32 Division operator would be like, the last thing I'd ever try. I know. Yeah, me too. I really thought I'm just like, this is the official this is really the way Yeah, I mean, yeah, this is the way but after this happened

22:32 came out, Jeff went to I don't know his last name. But on the comment he said his name was Jeff. So Jeff went to the episode page and said learning you can divide a time delta by time delta to come up with days, weeks, etc is like the Python tip of the year, it's certainly going to save me a lot of pain going, wait, there's 260 divided by 60, twice Sorry, that was actually hours, not days or whatever, like weird 60 of what I wanted, or 60 times as many days as I meant. So, yeah, you could divide a time delta by some arbitrary time delta of days equal five, and you'll get how many blocks of five days would have been in there as a number. I don't I'm not saying this is how it should be.

22:32 But I'm telling you, this is the way to figure out time ranges in Python. Standard Library without doing math. Well, so I looked it up. There's it isn't obvious that I mean it. It does say that you can do division. But there's all sorts of other stuff, too. You can do like, yeah, you can do floor division. You can do modulo, and modulo. How interesting. I mean, it makes sense, I guess. But why multiplication and jello by seven days? Yeah.

22:32 There's, like crazy. I had no idea that all this math was available for time deltas can use the matrix multiplication operator.

22:32 I wouldn't do that. It'll shoot you into the future. Oh, wait Anthony's already in the future. I don't know. This was trying. What's it like at star or something? Like? Yeah, power operator? Yeah. Anyway, I thought probably if I was surprised about this, and the other listeners were as well. And it sounds like you guys also didn't know about this. Like we should at least mention. Apparently, this is a thing. Tip of the year. Yeah. Yeah. Well, totally. If you want to make a really tricky job interview, please don't get over. My kids recently asked me because we were talking about like, weeks, and these numbers came up. And they were like, why do you know how many seconds are in a week? And how many seconds?

22:32 Cuz

22:32 I'm like, because I've memorized those numbers. Because I've been programming in languages that make your memorize how many seconds? Because there's not a total hours, there's only a total seconds that I need to know how many hours this is. Exactly. nicely. So here you go. Here we go. Pretty cool. So Anthony, are you fan of Monty Python? Monty Python? Yes. Yeah. So apparently, Microsoft is as well. Yeah, it took me a while to figure out the connection. But it was in the release notes. So they've released a new extension for VS code. And I'll explain why. But it's called pylons. And it's named after Lance a lot from Monty Python. And the holy grail who was Salatu was isn't that, yeah, he was the first one to get across the bridge with the hard questions.

22:32 So yeah, this is an extension for VS code. If you're already using VS code, you should download this and check it out. It's designed to be used with the existing Python extensions, there's not a replacement for the Python extension for VS code. And I think something about the Python extension is that if you're doing type checking, like type hints and stuff like that, or you're using a linter, if you use the Python extension, you can turn on a linter. And it will use one of the Python linters from the extension, by spawning like a process every time you edit the code and running the linter. Again, there's also something called the Python language server, which is written in dotnet, for some reason, and that is then communicated with by the VS code to figure out like the Python code and, and look at the hsts stuff. And that gives some errors and code, like highlights when you make mistakes and Python. So this pylons is an extension that basically provides type hints. And it does a whole bunch of like, extra little features like doc string automation, it helps you on function signatures, it does like type of heads, you could hover over a function call, and it'll tell you the method signature, and it will extract that from the library that you're using. So if you're using VS code, I absolutely recommend that you download this. This, check it out, there's some cool features that I found, like it does like code completion, it suggests parameters for you. So if you're like using a lot of libraries like flask or Django or you know, any kind of popular framework that's got timestamps, then this will basically make your life a lot easier because it's going to kind of fill in the gaps for you. And as you're typing, you can just press tab and just keep doing auto completion is support auto imports as well. So if you started using a function from a namespace in the standard library, or from somewhere else, it will be like oh, you probably want to import that it will add the import statement for you. It's also got go to reference and go to implementation, which if you've used the VS code extensions in other languages, like JavaScript or types

22:32 Script tool, you can right click on a function and go to go to reference or go to implementation, and it will jump to where that function is actually implemented. And now you get that with Python. But this it uses. I don't know how up to date everyone is on type checkers. But basically, there's my pie, which is now part of the Python, GitHub organization. And then all the big tech companies have written their own. I don't know why, but they I guess there was like, we have to write our own. It's like a rite of passage. So Facebook has Paya Google has pi type, and Microsoft has pi, right? They all more or less do the same thing, but in different ways. And this one uses the PI right type checker. So but the confusing thing is the PI, right was already an extension. So if you had that installed, on install it first, otherwise, it causes issues, and then install pilots. And a couple of other things I caught out in the shownotes is that this non default settings, which you should change, to make the plugin a lot more useful. So there's diagnostic mode, change that to workspace so that I'll inspect all files, not just the ones that you happen to have open, and change type checking off by default, changes to basic, and it'll give you more information. And yeah, I've been using it and playing around and stuff like that. I think there's a few bugs are starting to iron out. But this is a new release. It's not open source. So you can't contribute it. But I don't know if they'll change that in the future. And I think it's because they're planning on using it for some commercial product. But we'll see what their uses. But yeah, you should download it. Check it out. If you use the S code. Yeah, it looks like it takes the Python extension and just powers that up a little. Yep. So I'm guessing you don't if you don't run the vim plugin for this.

22:32 No, no, I don't I use this. This is a Microsoft Word. One, I use this. It's a custom mouse. Oh, that's really interesting. Does it live in a cage? Or how do you keep it? You have to feed it.

22:32 Now, I was talking to Julian secara from pi bytes yesterday, and he was telling me how much he loves him. And I said, so you add it on production then? And he was like, How did you know?

22:32 Actually, I'm pretty impressed with the vim plugin for VS code. It's a really well done. Well, this looks a cool project. And Thanks for pointing out the stuff that's off, like the type checking and the diagnostics for being just file based, instead of workspace spaced and whatnot. Another thing I think this adds is multi route workspaces. So a lot of these things come are already in PI charm, right? But like, I've got a, I've opened a big directory, and I want like two little directories to refer sort of within themselves. Right, treat those at the top level for code within each and I don't think that was possible previously. But now it is. It also says it's intelli code compatible, which I don't know how many people played with intellicode. I really haven't very much because I mostly stick with Python. Even though I had VS code open while we were talking. It uses AI to predict what you're going to type in need. So instead of just showing you an alphabetical list, it'll say, oh, you're doing request dot, you know, you should probably do get, we'll just do get doli. You know, things like that. So apparently, it's compatible with that as well. Yeah, I'm not a fan of intellicode. But I've used it a lot in JavaScript. And it kind of like guesses what the variable the function is. But it gets it wrong. Or at least did it the last time I used it, which is few years ago, but I get it if you'd like if one library made a typo or like suggest that. It's like, Oh, you wanted to do get Getty or something? And it's like, oh, yeah, cuz it scans the GitHub repos. And then it uses that to predict what it's going to suggest for you. Yeah, yeah. So half the suggestions are normally invalid with a really dynamically typed language, like Python, or JavaScript is it's, it needs to really import everything and properly understand the modules and how they're constructed to make sensible suggestions. Theoretical select suggestion I could actually make, let's find out. Yeah, I think that's what pilots kind of gives you is that it uses the type into the to figure out, and this is why pi charm is so powerful like it, it has its own typing system, so it knows it like indexes, or your code indexes or your dependencies. And it figures out like, what the types of the responses are, even if they don't have type annotations. And that's how it knows to watch the suggest, like which functions are available, which properties are there and stuff like that? So I think it's basically a step towards that. Yeah. And it's good to see and it will be very powerful vehicle, and it has a Monty Python reference. Yeah. Well, that's our six is anybody got any extra news as um, but I think first Yeah, my book is out in early release. So see Python in titles. And I got an email from somebody called keto. Asking if I've heard of that guy. I think he does. I don't this isn't even supposed to be showing this. But he was like, oh, have you read this book? Can I have a copy? So because I want to like

22:32 review it and, you know, that sort of thing. And, and I was going to reply as a joke and say is quite fast how much Python experience you have. But I thought

22:32 I don't know. I know he has a sense of humor. But yeah, my code of English sense of humor doesn't work on everybody. So he's gonna he's reviewing it. And then he did send back a comment saying he's gonna recommend it to people who want to become core developers, which is awesome. So yeah. And that's kind of why you put it together a little bit, right? Yeah, yeah, that was definitely the reason. That's the name of it again, C Python internals. And I'm updating it for the peg puzzle, because that got merged, like, in the middle of the initial release.

22:32 So I do have some updates for that. So yeah, cuz a whole bunch of the chapters, like, show you how the puzzle works and stuff like that. So I've been rereading this. Yeah. Cool. And you are on top python 265. So pretty recently, back in May, yeah. Talk about that, as well. So people can dig into that as well. Right? How about you just staying out of trouble and working as a nice person? Yeah, me too. I got to go out and do fireworks with the kids. That was fun. So for me, I already mentioned the Humble Bundle, but talk slash humble 2020. As all you got to know $1,400 worth of Python stuff for 25 bucks, it's probably worth the risk. So it's better than the reverse $35 with the stuff for 1000. It'd be terrible. Some people try to sell that. But yeah, for sure. Speaking of Python, three, nine, pig parsers, Python three, nine, beta four is out and ready for testing. So if that's the thing that you do, and that you probably run in that production already, given how much you're on top of it. Number 310 Alpha one.

22:32 Of course, of course. Also, we have a cool course coming at talk Python training called Excel to Python. So if you've been doing a bunch of stuff with Excel, I'm going to get into the into the data science tools instead. And do Excel like things partnered up with Chris Moffat are doing really cool stuff there so people can go get notified about when that course is out. Maybe in a month or so. All right. Are you all ready for a joke? Yes, Anthony, I usually make Brian play the other half of this. So you're gonna have to do it. Alright, so this is a cartoon, the picture is going to be in the show notes. You can even view it in your podcast player, if you allow it to show images from Scott Hilburn. I couldn't find the original place to link to so I just put a image up here. And it's two computers, a laptop and a desktop looking at each other. There's a baseball cap on top of the laptop, and he's got little like, computer arms up. He's like sweat. He's like, I can't get it off. Anthony, what's the problem? And the other computer says, dude, that's because your caps lock is on. locked on?

22:32 Yeah. Okay. Anyway, so I bought that. That wouldn't make me laugh, especially the picture. So check it out your podcast player. Yeah, I can tell what he's trying to get it off to looks like a red hat. It definitely Yeah. Yeah, that's probably like Windows Vista got red hat on and can't get it off.

22:32 Cool. Well, thanks, guys. All right. Yeah. Thanks. Great to be here. Thanks. Thanks. As always, Byron. Thank you for listening to Python bytes. Follow the show on twitter at Python bytes. That's Python bytes as in be yts and get the full show notes at Python bytes at FM. If you have a news item you want featured just visit by thumb and send it our way. We're always on the lookout for sharing something cool. This is Brian Aachen and on behalf of myself and Michael Kennedy, thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page