Python Bytes - #221 Pattern matching and accepting change in Python with Brett Cannon

Episode Date: February 19, 2021

Topics covered in this episode: Keeping up with Rich 12 requests per second Python Launcher for Unix reaches RC (probably 😉) Build a text editor with Python and curses Pattern matching and accep...ting change in Python A Quick Intro to Structural Pattern Matching in Python Extras Joke See the full show notes for this episode on the website at pythonbytes.fm/221

Transcript
Discussion (0)
Starting point is 00:00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds. This is episode 221, I think, recorded, when is it, February 17th, 2021. I am Brian Auchin. I'm Michael Kennedy. And we also have Brett Cannon, yeah. I always talk over the third person, I'm not sure why. Well, you're always going like, is there going to be an introduction or should I just join the Brady Bunch theme? Let's just go in a circle and just introduce ourselves.
Starting point is 00:00:26 Well, if we're going to do Brady Bunch, we've got to have more people so we can fill out, what is that, like rows of three or whatever in the picture? I'm sure Anthony Shaw and Paul Everett are available based on how often they show up here. So I'm sure they're waiting in the wings. That's right. We'll just swoop them in here for the right picture. Welcome, Brad. It's great to have you here. Lovely to be back.
Starting point is 00:00:44 You know what, Brian? I'm impressed with Brett's microphone. He has mastered the work from home. Yeah, I love this. We're going to have to put a link in the show notes to this thing. Tell people about this. So, Brian and I both have good microphones. We have many different microphones we've tried, but yours has a visual aspect, which is unusual for audio. Yeah. So it's a HyperX Quadcast S specifically. And it comes with RGB lighting because it's really a gamer mic. But obviously in pandemic times, I work from home. And my wife is also at home because of the pandemic. And we always had an issue of her wanting to come in and not knowing whether I was actually
Starting point is 00:01:22 occupied actually in a meeting because I'm in them a lot for work or whether or not I was just sitting there with my headphones on listening to music or whatever and she could totally just walk in and so the great thing about this microphone is if it has a touch sensitive top and if you tap it the LEDs turn off and so it acts as like an on air light for the room I mean it's not that bright specifically but if she opens the door she can totally just look in and go is the mic lit and if the mic's not that bright specifically, but if she opens the door, she can totally just look in and go, is the mic lit? And if the mic's not lit, she knows she's not going to be heard or be directly interrupting me. And I can just turn and answer any questions she has. And it's awesome. It works out great that way. That is so fantastic. The whole mic glows when it's on and active at different colors. It's beautiful. I love it. Yeah. And you can even
Starting point is 00:02:01 change which colors it uses. This is, I can't remember if it's waterfall or not, but you can actually change how the color spectrum changes from side to side in terms of colors and whether it's top to bottom or not. It's very pretty. I think I once did Harry Potter color themed for a coworker of mine. He's a big Harry Potter fan for all the houses. And I, I've purposely not played with it and kept with the defaults. Cause it's definitely one of those things I could totally nerd out on and play with the colors all day long. I tried Python colors once. The transitions didn't look quite as nice, but you know. Yeah, no, it's good.
Starting point is 00:02:29 I have the microphone that matches, or sorry, the mouse that matches it. Oh, nice. And it pulses. So I didn't get it for the color, but it's the only one I could get that had color. I'm like, why is it of color? How do I turn this off?
Starting point is 00:02:40 But no, it just has color, it's fine. But anyway, great, Mike. I think people should check that out. If they have like weird work from home situations and people are interrupting, it's super colors. Fine. But anyway, great. Mike, I'm, I think people should check that out if they have like weird work from home situations and you people are interrupting. It's super cool. I love it. Definitely get a Mike, uh, Mike stand though. The default stands a little low. And I have found that the getting a cheap, uh, like 10, $15 stand, I got this from Amazon that pushes it off about seven inches. I think I'm trying to do the American units. Uh, it pushes up about 15 centimeters.
Starting point is 00:03:06 It's a nice sweet spot in terms of distance while it's still not completely taking up your vision in the screen. Yeah, excellent, excellent. Well, Brian, you want to kick us off here with our first topic? Yeah, well, we've got, it's hard to keep up with Will McCougan.
Starting point is 00:03:22 Sorry, Will. Will wrote Rich, which is, I forget what he calls it. Basically, it's a CLI tool. But there's been a whole bunch of really cool things he's done recently, like really recently. So in December, he added Live View, which allows you to just, it continually updates whenever an event happens or something in that part of the screen, which is cool. Um, he didn't write a blog post on that, but then in January, uh, tree view came out and, um, the tree views are lovely. You can do all sorts of stuff, uh, with the tree view. And, um, yeah, I just, it's, it's a nice thing to have in a CLI tool.
Starting point is 00:04:09 And then what's really impressive to me, I think, was layouts. So this month he released layouts and it allows you to split the screen up. And his demo even shows it happening like within a VS Code. Oh, yeah. Within the bottom terminal part of VS Code. Oh, yeah. Within the bottom. Yeah. Terminal part of VS Code. Yeah. Brett, you've heard of this, right?
Starting point is 00:04:30 You've heard of this tool? How can I not? I'm a fan of the podcast and Brian loves this tool. So I've heard about it multiple times. So I guess we've covered it before. But one of the reasons why I'm covering it again, there's a couple of reasons, is the layout's neat. And really, now I want to click on stuff and I want to do entry. And he sort of hinted at that, that he's kind of going towards a full TUI, which I had never heard of before, text user interface.
Starting point is 00:04:57 Yeah, TUIs. All right. Right on. That'd be cool. So I think that would be neat. And I'd like to encourage that. So the other thing that's going on with Rich is he's accepting sponsorships now. And it's kind of hidden in the demo window.
Starting point is 00:05:11 But we're highlighting it on the show so more people can know about it. So GitHub, he's doing sponsorships on GitHub. And I like how GitHub sponsorships work. It's kind of neat. So check it out. The other thing that I guess when I was playing with these layout things that I didn't really realize before is you can just say Python dash em rich and it shows a little demo of a whole bunch of stuff.
Starting point is 00:05:36 And then some of the particular parts of it, you can demo them individually. Like for the layout, you can say Python dashm rich.layout and it'll show a demo. The tree also has a demo. And the live one, actually, I couldn't escape it. I had to kill my window. So the live one just continually updates some... I don't know if it's actually going out to the internet, but it's doing some conversions of monetary conversions. And it just kept updating, and it doesn't hit Control-C.
Starting point is 00:06:12 So it's got a bear except somewhere they shouldn't have. I think it's very reliable. I mean, the only way to exit it is force quit. So we're all kill-9. Where's your friend um so yeah i'd love to have uh some um have rich continue with this and make it a full uh 2e that'd be fun that would be very cool because the presentation is really nice here i will also fully support will making this a full-on thing because actually a couple months ago i did a slight dive on a weekend trying to find some 2e libraries
Starting point is 00:06:44 because i i have a personal project for work purposes that i've been trying to do a gui for and two years in a row i've tried to do it during hackathon week at microsoft and i keep failing because i don't have enough time to dive into all the gui libraries that go from like here's how to do hello world here's the reference and it's like no no i i need more more steps there um where's that middle ground come on yeah exactly and then i decided oh well this this i totally could just do this in curses it's like it's literally just to keep track of what i do every day and it's just like it's snippets if from google is where i picked up the habit of just literally just oh i did this
Starting point is 00:07:19 today that was out of ordinary i did this out of today that was out of ordinary just to kind of track the high level not just meanings but i actually did something different today and it's like oh i could totally do this in the terminal it's like suddenly pull up and curses library it's in the snare library and it's like oh yes you need to know the size of your terminal window and all this other stuff and oh how to move the cursor to this specific position it's like yeah no i still don't have time for this so exactly move this along and uh input work, I mean, I would be totally down for giving it a shot. Yeah. Yeah, quite cool.
Starting point is 00:07:49 And if people don't know, you kind of live an alter ego. You've got Brett Cannon, open source steering counsel, and also work closely with VS Code at Microsoft, right? So having a screenshot on the screen is all right at home. Yeah, yeah uh just for people who don't know i'm the dev manager for the python extension for vs code that's that that's uh how i pay for my open source habit which includes uh being on the python steering council on the core dev yeah yeah quite cool so uh gandalforf uh says i've been using prompt toolkit for the twee library for a while but uh this rich seems a lot nicer if it actually accepted input, which I agree.
Starting point is 00:08:29 It seems very cool. And I've heard some people using them together. I just don't know how to do that. So if somebody wants to write a tutorial on how to use both rich and Prompt Toolkit together, that'd be cool. Yeah, that would be cool, actually. All right. What I want to talk about is this article I ran across and some tools that I went to play with afterwards after reading it called 12 requests per second. Sounds amazing, right? So it's a realistic look at web frameworks and Python web frameworks. So if you look out
Starting point is 00:08:58 there, you'll hear things like, oh, we're getting 100,000 requests per second on UV loop with a single thread. Or, you know, we've got Sanic doing 100,000 requests or even Gepronto up to 1.2 million requests per second. Right. Which is amazing. And then a lot of these examples are doing like really not not real type of work. Right. They're just doing some little tiny thing like, oh, here, let's add two numbers and tell you how fast we can do that. So this article is a more like, well, let's go through a real application
Starting point is 00:09:31 and see what kind of performance you might expect. So I thought it'd be fun to talk about this because it gives some people some things to think about. You know, how can you compare your app to these types of quotes that people are getting and so on? And would it be better to choose something like how can you compare your app to these types of quotes that people are getting and so on? And would it be better to choose something like DiPronto or AIO HTTP or FastAPI or something like that over, say, Flask or Django, which don't have so much support for things like async? So I thought this was fun to go through and just kind of look at it.
Starting point is 00:10:00 They start out by profiling just sort of a Hello World app and they get, all right, well, Hello World's pretty good. If you run Flask on CPython, you get some amount here. Maybe it was 500 to 1,000. You run it on PyPy, they were able to get 3,000. And so that's just Flask run, right? Which is not really the way you should probably be doing things. You should be running on G-Unicorn G Unicorn or micro whiskey or something like that. So if they ran the same thing on G Unicorn,
Starting point is 00:10:30 right, it's up to like 12,000. And you run it on compare that against Sanic, you get you know, Sanic was doing like 24,000 or something. So these comparisons, I thought would be fun for people, you can go through, they've got a bunch of graphs that you can check out. But then they write one that actually talks to a database doing databasey things. And then let me get down to the numbers here, the bottom for that. And they're like, OK, well, with this one,
Starting point is 00:10:51 now we're running at quite a bit lower request per second. And I think in the end, they said, for our real app, what we ended up with is a whopping 12 requests per second. Yeah, here we go. Here's the graph I was looking for. Where like, this is Flask running the synchronous Postgres driver there. And that's all pretty interesting. I think, you know, even be able to answer the question, you know, well, what about me?
Starting point is 00:11:17 What about my app? How would it do if I were to run these things against it? And we've talked about Locus before. Locus is a really fantastic way to write load testing and user interaction testing against websites, web APIs, and so on. And it's all about Python. So what you do with this is you go through and you write some kind of class and you say, okay, here's a test, like a representation of what people might do to my website, right? They might log in, they might go view the episode page. If we were testing the Python bytes site, or they go check
Starting point is 00:11:50 out the episode page, they might drill into an episode, they might do a search. And what you can do is you write simple little bits of Python to say, here's a function that does this action. Here's a function that does that action. Like here's one that goes to the episode listing. And then you can actually, it's not shown in the example here, but you can say things like, well, you know, 10 out of 15 times I want them to view an episode page. One out of the 10 times I want them to do a search. And three out of the 10 times I want them to actually go to the listing, right? So you can sort of break it up to what the normal look would be. Then you just run Locus and you get like this web UI where you enter some information
Starting point is 00:12:27 and then it just runs, if you want, even in a distributed way against your site and then pounds it until it gives up, basically. Brett, have you heard this tool? No, I actually haven't. I mean, you hear about different tools for different things,
Starting point is 00:12:40 but this is pretty, looking at this example, it's pretty simple, which is pretty great. Yeah, the simplicity is really great. And then when you run it, you actually get a web view into it. Then the web UI lets you basically control and monitor the tests in real time. So anyway, coming back to some numbers off of that, I decided, well, if they're getting, you know, 12 to 80 requests per second, what does my stuff look like? Like, for example,
Starting point is 00:13:03 let's talk Python training stuff. It's not using any of this async stuff. How is it doing? So it's Python 3, MicroWSGI, Pyramid, MongoDB on a $20 server. Would it get 12 requests per second? I don't know. So I turned this thing loose
Starting point is 00:13:18 and it'll do about 125 requests per second. I felt better than, that's better than 12. I felt pretty good. But one of the things that's cool about Locus is you can tell it not just, I want you to use this partitioning, but also I would like you to have a distribution of how often the user actually does something. So you can say, well, this user is going to make between every 10 to 60 seconds, it's going to do some, one of these things among this mix.
Starting point is 00:13:46 So instead of just pounding it, it's like, well, an average user doesn't just hit F5 or Command R as hard as they can. They move around and they pause, right? So you can pause that. So I don't know, maybe it's 10 to 20,000 realistic users I was able to sort of map out with this. Anyway, it was just a fun deep dive into like, well, what does performance look like?
Starting point is 00:14:03 How important is async? Some of the tools to do it. I don't know if people are, if that's interesting people, definitely check out this 12 requests per second article here. I think, I think you'll enjoy it. Then also check out Locus if you want to try to answer that question for yourself. So I was curious how, when you're testing your site, can, did, did anybody else like experience downtime or something while you're being on it?
Starting point is 00:14:26 Well, so that's the question, right? With the Locust thing, you can start to see what the real-time, what the response times are and everything. It never crashed. It just got a little bit slow. So I ran it locally and I'm like, well, what's it look like in production, right? So I'm like, I really want to know, with all the way that everything's put together, what number will I get? So I'm like, I'm just going to turn it loose on it. And if it starts to overwhelm it, I'll just hit the stop button, you know?
Starting point is 00:14:51 And it never died. It just got to where it took like 300 or 400 milliseconds to get back to me. So it was okay. Okay, good. Yeah, so pretty fun. Pretty fun example there. I think one other thing I appreciate
Starting point is 00:15:01 about that blog post actually was they pointed out towards the end that at some point scaling is no longer a Python problem and it's an infrastructure problem. Like, oh, it's probably better to update your database and stuff. And I've heard this from a lot of people too, of there's kind of a misnomer if you're not in the Python community that, oh, Python's so slow, it's going to be your bottleneck. And instead I've heard it from a lot of people in the community that, oh, actually it's not, I can get my work done in a third of a time, and then the two-thirds of time it would have taken me to do it in,
Starting point is 00:15:28 I don't know, Java, just choose a different language. I can optimize my infrastructure. And guess what? I end up with the same performance with more time to bug fix and test than I would have on the other platform. And the other thing is, obviously, there is always throwing more hardware at the problem if you need a horizontal scale.
Starting point is 00:15:44 But, and honestly, I think when I say this post also i think from our credit point out not everyone needs a thousand requests a second yeah right like most people don't even popular websites yeah are not doing a thousand i mean that's a lot of requests a thousand requests a lot like yeah most people measure inquiries per minute not per second right yeah so like even 12 per second like we're still talking 720 if my math is not finding me on the spot request per minute right that's still a decent cliff like if you're running a business that's getting that much traffic every single minute you're probably still doing pretty good for yourself yeah that's 32 million page views uh per month right that's that's like you're
Starting point is 00:16:25 at a limit where you got some real stuff going on some real infrastructure that well okay so but there's also if i've got services running i've got a bunch of services that include this i mean one one user in our interaction isn't one hit it might be dozens so yeah so so my rule of thumb is honestly don't worry unless you're going over a hundred a second, like you should be able to hit a hundred a second without too much effort. And then after that, you might have to start doing some planning, but I would suspect as a general rule of thumb, you can, you can handle hundreds without a whole lot of effort in Python. And if you get into a thousand, you might have to do a bit more planning for it, but it's totally serviceable for that
Starting point is 00:17:00 kind of thing. Yeah, totally agree. Magnus Carlson has a quick comment. Nice. So I can now see if my work turning my fast API app into async was worth it. Yes, you can. That's a very good use of that. I'm going to be biased and just say it was totally worth it, Magnus.
Starting point is 00:17:18 You just don't know yet. Because it's got the cool new design patterns. Absolutely. Exactly. All right, Brett, you're up next. You've got something special for us. Yeah, so the world exclusive news breaking thing is the Python launcher for Unix is probably at RC stage.
Starting point is 00:17:39 For those of you who don't know about this, it's a project I've been working on since May of 2018. And if you're a Windows user, you probably know what I'm talking about. But on Windows, there's a little app called the Python Launcher for Windows, and it ships with Python and it gives you the py command. So sometimes you might see this on websites where they say, well, if you're on Windows, you run Python using py and then the command and other platforms just run with python 3 and i decided that i kind of wanted this on unix i had had enough people complain to me about like how it's difficult to get started we're having the windows instructions on how to run something was always
Starting point is 00:18:17 different from the unix version and all this yes that is really annoying the very first thing you got to do like right at the start like oh's so easy, but there's these two ways. There's like this diversion, right? Exactly. And I saw some benefit to the Python launcher because what it does on Windows is it serves kind of two key purposes. One is it kind of makes up
Starting point is 00:18:38 for the lack of shebang support on Windows because the launcher will actually look for shebang line, figure out what version of Python is required, and then finds the right version of Python to run it. The other thing is it does away with the need of caring about what order you installed your Pythons in. Because like, for instance, on Unix, like Python 3, what does that point at? Well, what it points at is the last version of Python 3 that you installed, not the newest version of Python, right? So if you installed 3.9 today, but then installed the 3.8 security release that I think happened yesterday, you will get 3.8 as your version for Python 3. So if you don't specify Python 3.9, you won't be
Starting point is 00:19:16 running it. Like you have to either create your virtual environment and be using it that way, or remember that. Python Launcher takes care of all that. It will automatically just figure out what versions you have installed and just automatically run the newest version. And so I really like that. So I decided to implement it in Rust, partially as a Rust project of decent size. And it's about 1,000 lines of Rust code.
Starting point is 00:19:37 And also because I wanted it, because if this works out, hopefully some projects can stop listing two different ways to run things. So in the Unix version, it's a little different from the Windows version. And I'll ask for feedback from the two of you and anyone in the live stream if they want to provide it. First, it looks to see if a virtual environment is activated. So it looks for the virtual under env environment variable. And if it's there, it just uses that.
Starting point is 00:19:59 So automatically, this is a little shorter and easier if you have an activated virtual environment. It's just py now instead of having to type python uh the next one is if you're here to save us from rsi already this is i'm kidding but this is really interesting keep going yeah one third the typing um the other thing is if you create a virtual environment in a dot e dot v e n v directory it will also automatically use that without activation. So once again, if you use the, I personally think standard nomenclature, name your virtual environments dot venv, you don't have to activate them anymore. Because activation is just a shorthand for the shell that honestly, I typically just use to make Python do the right thing.
Starting point is 00:20:42 Because I use dash m for everything uh even when i'm in an activated environment this takes care of that entire step for me so i don't have to activate my environments anymore okay that's super cool after that it does the shebang just like on windows uh trying to figure out what the right python might be for that and then after that it checks some environment variables like if you want to if you have 3.10 installed for instance for python you have an alpha installed but you want to make sure that if you ever say, hey, if I say Python, if I run Py with no arguments or say, hey, I want to run a Python 3 version of Python, you can actually set the environment variables to restrict it and basically specify the exact version you want. And then after that, if none of that triggers,
Starting point is 00:21:18 it just finds the newest version and runs that. I've been running this personally for a while. And when I added the.venv support, I've completely switched. I've been running this personally for a while. And when I added the dot venv support, I've completely switched. I don't even bother typing Python anymore, because this completely fits my workflow of just doing exactly what I think it should do whenever I need. Now, the question I have for the two of you and anyone in the audience who cares to answer is,
Starting point is 00:21:40 do you think prioritizing virtual environments over shebangs makes sense? Now, my argument is yes. Obviously, or else I wouldn't have done it this way. But this is partially, I don't know how much of this is a Unixism versus just in general, because I do hope to actually add
Starting point is 00:21:54 Windows support to this as well and make this a universal Python launcher. So the reason I did it this way was, on Unix, you can just chmod a file and have the executable bit, and that's how you can execute it. And honestly, most of my files at this point are going to be in a virtual environment anyway, whether installed via pipx or I create an entry point and I install that. So once again, I don't
Starting point is 00:22:14 need the shebang directly. It's just going to be baked into the executable. And Windows will do the exact same thing, right? Like setup tools will give you that little shim. So to me, if I am running in a project directory with a virtual environment, whether activated or not, I'm assuming that's what I want. Don't try to figure it out for me or else I'd be running this somewhere else and I would not have a virtual environment installed.
Starting point is 00:22:36 Does that logic make sense? Do you two think I made the right decision here in choosing virtual environments over shebang lines or am I crazy? I forgot shebangs were even supported. I all about virtual environments yes okay cool i think this is fantastic i've long wanted an easy way to just say i'm down inside um maybe you can tell me if it works this way it does it traverse up looking for a virtual environment like if i'm in a sub directory and i try to pie a file but one directory up there's a virtual environment? Like if I'm in a sub directory and I try to pie a file,
Starting point is 00:23:05 but one directory up, there's a virtual environment. Will it go up and find that and then use it? No, I did not implement it that way. It would not be too difficult to do it that way. But for simplicity reasons, when I first plugged this in, for my purposes, I'm not an SRC guy like Brian is, for instance. So I don't need to worry about that as much uh but that would be totally reasonable uh feature request to ask for to be able to traverse output directories looking for the dot vnv director yeah yeah very cool i'm down a level in my src go up a level to find right like i have a lot of things that will do like maintenance for my website so i'll have like a bin folder as one of the subfolders of my website then i'll go in there and i want to run something. If I'm like, oh, I should have run and gone up and then
Starting point is 00:23:48 bin slash. I think it'd just be really cool. Like I'm sort of in the realm of this virtual environment, even if it's not at the same working directory. Yeah. And one thing I do want to clarify here is this is very much about simplifying running Python manually. It is not meant to completely replace running Python, right? Like a misnomer I hear from people when I tell them about this is like, oh, hey, are you going to add a config file to be able to alias to PyPy versus specifically, or this thing, or a framework builder, that thing is. And for me is if you have that kind of specific requirement of a specific version of Python you have installed, just use the absolute paths of that version of python i don't think this is this is purely for i just want the newest version i don't
Starting point is 00:24:29 care what it is just give it to me or i have a virtual environment just give me the virtual environment i don't want to have to think about it if you have to put thought into what kind of python you want to run i think you should be specifying that manually not be using this well so on the on the side of side of the being able to go up a couple directories looking for virtual environments, I'm often not in the source directory. I'm often sitting in the tests directory running PyTest on stuff,
Starting point is 00:24:54 in which case, I guess I already am in a virtual environment, so it doesn't matter. But I might just open up another terminal and try to just run Python. So I like this. I'm excited to hear that this is eventually going to be a Windows thing also, hopefully. I don't actually normally use the Python launcher on Windows. It doesn't do looking for virtual environments, does it?
Starting point is 00:25:20 No, that is exclusive to the Unix version of this launcher. So basically, the environment variable it will use, it doesn't actually look on path. It completely uses the Windows registry. It does the shebang, and that's it. So looking in the.venv folder, that is entirely my edition. And the order of execution here is kind of tweaked to what I think. And it doesn't search on path actually. So that's a Unix thing specifically.
Starting point is 00:25:53 But I suspect this actually helped with the Windows Store, although I think Steve Dower fixed that issue with the Windows Store install. But yeah, so there's slight tweaks. But I figure if I have all the logic done already, there's no reason not to just make it universal to support multiple platforms. So why not? Yeah.
Starting point is 00:26:07 So your announcement here has kind of lit up the live stream. So ZDocs is just a Brett Cannon fan, which is awesome. Gandalforth asks, is the Rust version cross-platform in any way? Is there a chance of this on Windows? No, i've not
Starting point is 00:26:25 tried it on windows uh it definitely works on mac and linux right so it is it truly is unix based so it will handle that no problem i have not tried to wire it up into the registry at all so that's not there i have an open enhancement uh issue to do that i honestly don't know what would happen if you tried running on some windows i haven't tried. Everything's very hard-coded to Unix at the moment, just to get this done. If you look at the readme, you'll notice everything is slash bin.
Starting point is 00:26:54 There's no scripts support here. If slash one, I do Windows support. Obviously, I'll look at fix, but I have put in zero effort because the Python launcher for Windows just comes with the install from Python.org. Right. So there was no real time pressure to try to get that done. So I haven't tried. I'm a big fan.
Starting point is 00:27:11 I could try this on my Mac OS and I'd be happy now. Yeah, this is how I do it. I have it on my Mac. I just install. You do have to install Rust to install it right now because I haven't figured out how to do distributable binaries that you can just download but yeah if you have rust installed um which you can get through rust up or homebrew or whatever it's just a cargo install away so if you want to get a shot please okay fantastic and then i kind of forgot that uh my mac was unix c that's right then magnus agrees on the vmv over shebang awesome and get candle force is uh same as well i don't think i've ever seen
Starting point is 00:27:45 a shebang that was more specific than user ben python 3 anyway yeah and i actually suspect the shebang support was partially because the python launch has been around back in python 2 days right where that was much more of a concern so like as i said i started this in 2018 so it was pre python 2 deprecation so it's still supported there but a But a lot of this, I think, was also partially to support the two to three transitions. So those little extras here, I don't think are quite as important unless Python 4 happens someday,
Starting point is 00:28:12 which there are zero plans for. So I don't know. Yeah, don't hold your breath. By the way, one extra nicety I want to tell people is if you're a Starship user, the Starship cross shell prompt, there's a setting in Starship that lets you specify how it figures out what version of Python
Starting point is 00:28:31 you have. Now, it does look for virtualenv, but otherwise it has a list of binaries that it will execute to try to figure out what version of Python you have. If you set it to Py using this, it will always tell you either what the virtual environment's Python version is in the prompt or whatever the newest version of Python is installed. So it has a really nice side effect because if you read the docs in Starship, there's a big tip saying, hey, if you have a Python installed that's default, i.e. Mac OS, and it'll always say 2.7 unless you happen to have an
Starting point is 00:29:00 activated virtual environment, which always threw me because it's like, yeah, I'm not using 2.7 in this project. As soon as I added this support for.venv files and tweaked my Starship config for this, it always tells me the exact version that I happen to have set up for my virtual environment. It's really handy. For those of us not in the know, what's Starship? So Starship is a cross-platform shell prompt tool.
Starting point is 00:29:22 So it's written in Rust. But basically what you do is it has instructions for Bash and Zish and Phish and PowerShell and everything else. And basically it just gives you a line. Brian's got it pulled up on the screen for those on the live stream. And it's basically just an easy way to just say like,
Starting point is 00:29:38 hey, this is how I want my prompt to look. Don't worry about whether it being Bash or Zish or Phish, whatever. Like I'm a Phish user. I'm sure Michael's probably a Zish user being a mac os user like he is yep um but it shouldn't matter my prompt is a prompt and pretty much they have pretty consistent user support so i decided yeah you know what i like some of the niceties it has automatically baked in it does like notification it changed prompt for the usual oh Oh, I edited my Git checkout. It'll tell you what branch you're on.
Starting point is 00:30:07 All these little nice things. And setting Fira code as my font gives me all the nice little glyphs that I want. And so I said, nice. All right, cool. It'll tell me what version of Python is currently activated. Except for that annoyance of being on Mac. It kept saying, oh, you've got 2.7 until I activated. And I was like, no, I don't like this.
Starting point is 00:30:24 So I prioritized getting the.vnv done. And then lo and behold, it magically now tells me exactly what I want for Python. Nice. Wow, that's super cool. Yeah, now we know. Starship, fantastic. Yeah, so before we move on, I'd like to thank our sponsor. So this episode of Python Bytes is brought to you by Datadog.
Starting point is 00:30:43 Are you having trouble visualizing latency, CPU, and memory bottlenecks in your apps? And not sure where the issue is coming from or how to solve it? Datadog seamlessly correlates logs and traces at the level of individual requests, allowing you to quickly troubleshoot your Python application. Plus, their continuous profiler allows you to find most resource-consuming parts in your production code all the time at any scale with minimal overhead. Be the hero that got your app back on track at your company. Get started today with a free trial at pythonbytes.fm slash datadog.
Starting point is 00:31:18 Or just click the link in your podcast player show notes. Ooh, that's neat. Yeah, very cool. Thanks, Datadog. So, Brett, I want to take you down a little bit lower. If it's turtles all the way down, a few turtles down to this whole TUI world and talk about this thing called build a text editor with Python and curses. Is curses, is that what you do when you get upset because it's too low level or,
Starting point is 00:31:41 oh no, it's about the curses. Sorry. Okay. Gotta remember I'm on the Python bias bias podcast there are going to be jokes like that they're going to be bad too by the way so now here's a really cool article by uh wasim lorgat about basically walking you through building a text editor like vim or emacs in the terminal using curses which is a library that lets you control what happens on the screen much better than like print and log and warn and whatnot. So there's a couple of just interesting things. I thought going through this might just give people a sense of like what it's like to work with Curses. And then there's this context of this text editor you can play with. So for example, a minimal Curses app, all you got to do is define a function. That's your main function. And then while true, go to the screen and get the key and that's
Starting point is 00:32:25 it you just say get key and it just gives you whatever it gets pressed uh without any help here there's probably not a way to get out of it no maybe ctrl c but uh yeah there's not like a quit or anything so you can really easily add a like some tests and say well if they gave me the key you know escape then show the little colon, you can WQ exclamation mark, whatever to get out of it. However you want to exit your, your text editor that you're building. And then they talk about how to show stuff on the screen. So if you want to just add a line, you can say at this X, Y screen, you know, cursor location, just write this line of text on the screen and it'll, it'll that so real easy and you know one of
Starting point is 00:33:05 the things they do is they pass over the file name and it's kind of meta like they edit the file that is the demo for the editor with the editor as they're building it which is always fun to do so you can do that but then through this article they go through and they build out like a window class that talks about how big is the screen this is what brett was talking about like i gotta figure out what my screen looks like and all that stuff and also a cursor where you are on the screen how to have like a view into the file because you might have like moved to the right a little bit and the file might be a thousand lines but you've only got a 40 on your screen or whatever so anyway if this is interesting to you i think you should go through this article and check it out.
Starting point is 00:33:45 In the end, you end up with a pretty simple but non-trivial little text editor that lets you do stuff. So I think it's pretty neat. What do you guys think? This shows me why I really hope Will grants Brian's wish of making Rich a full TY library.
Starting point is 00:33:58 Yeah, I do agree. I think if Rich, if something like that that has a really beautiful display technology, but also has input, like this is cool because it has really great way to accept user input and like update the screen. But it's very low level. It's like, I don't know, it's OpenGL versus Pygame or Arcade. You're like at the level of here's what I put at this cursor, this XY coordinate. Let's put that there yeah i think it's a great showing of actually how much work it actually needs to go into making those full text based uis that you see like it like you used to
Starting point is 00:34:29 see at the grocery store and those screens you probably still do it some of your grocery stores on that screen and just like or how when they book your airline ticket and you're like oh my god what the hell you're using you do this all day yeah exactly it takes a lot of work to make those things happen it's surprising how much work it is. And hence why getting higher level libraries, like I think it was a prompt toolkit we were told about earlier and rich and all that would be very welcome in existing. Yeah, absolutely. Do you got either of you guys know if there's any curses libraries for
Starting point is 00:34:58 windows? Magnus is asking. That's why he's used prompt toolkit before, but I'm not sure actually. Neither am I. Yeah. Yeah. Cool. Cool. All right. That's why he's used Prompt Toolkit before. But I'm not sure, actually. Neither am I. Yeah. Yeah. Cool, cool. All right.
Starting point is 00:35:08 What's the next one? Brian, you got the next one, right? Actually, I skipped. So Brett's next. All right, Brett's next. And I'll pull up Brett's thing. All right, Brett. Okay.
Starting point is 00:35:17 So there's been a major language feature announced that's coming in 3.10, right? Yes, which actually was in your quick uh links at the end of episode 220 um which brian called the uh five barrel foot gun which is pattern matching um so one of the things that always happens whenever there's a new python uh feature that gets announced and especially one of this size that gets out into the general community uh is some interesting feelings from people and so this is kind of slash i don't say rant but little just me as a steering council member just trying to explain how this came how this all came about where we all where we're coming from as a steering council in general i mean obviously i'm speaking for me directly but i generally i think how the steering council kind general. I mean, obviously I'm speaking for me directly, but I generally,
Starting point is 00:36:08 I think how the steering council kind of thought, but also just kind of helping put all this in perspective. Cause I think for a lot of people, this might be the first big feature that they've seen because these do this all the time in Python too. Um, but things kind of slowed down for Python three. So as I said, I've seen around the internet, a lot of people ranging from, Oh, this looks really cool. I can't wait till I can use it, to people screaming bloody murder that we're killing Python. And oh my god, it's the death knell of the language. I've been doing this for 17 years. Is that stressful for you? It used to be.
Starting point is 00:36:34 It used to be stressful. Now it's just frustrating. So for instance, I gave a talk at PyCon US 2018. It was one of the keynotes about participating in open source. And one of the key things I said in it was people just need to try to be kind to each other. It's kind of a very generic thing, I know, but it really makes a difference. As a project maintainer myself, right, like having people tell me what they think I need to be doing or what I should be doing is really frustrating, right? Like I put my personal time and effort into helping make this happen.
Starting point is 00:37:09 And the way you respond to that is tell me what I should be doing. Yeah. Like I can only imagine people who are parents having other people tell them how they should be raising their children. It's worse than helicopter parents. It's like helicopter backseat parenting. Exactly. And it's kind of the equivalent for open source maintainers. People doing the backseat, oh, here's what you really should be doing with your free time, with what little time you have left on this planet, right?
Starting point is 00:37:33 Yeah, yeah. So it used to get really upsetting, and now I'm just frustrated and just disappointed that this still happens. It's also a little weird, too in python right i mean we have tens of millions of people using language at this point right it's it's immeasurable it's just cute which means even if you assume one out of a thousand people are jerks right 0.1 percent right like we're still tucking tens of thousands of people out there who basically know my face name and address and feel totally fine sending me mail on occasion or just posting out in the commons outside where we all congregate about what they
Starting point is 00:38:10 think i should be doing with my life so it's one of these things where it's just frustrating like i i don't know a lot of people feel that sorry but i think um when you hear those negative things said to you even if a thousand people are appreciative, the one negative thing you get feels so much. It makes such a bigger disproportionate. Ten to one. Yeah, at least. At least. At least.
Starting point is 00:38:33 And the problem is it's not relative numbers. It's absolute numbers. And at the scale that we're at with Python, the absolute number of people who just don't haven't quite either just I mean, honestly, some people are just totally ignorant that they are speaking this way and that they don't really realize the way they're phrasing things matters, or even that the way they're phrasing it comes off that way. Like not everyone who says should really means for it to come off that way. Thank you, Dean. I appreciate the awesomeness call out. But it's one of these things where I have to bring this up every couple of years. And then I usually end up doing a blog post, which honestly, this is kind of a rough draft of the blog post. I'm just talking out loud with all of you and bouncing ideas off all of you for the feedback. But it's just, it gets a little
Starting point is 00:39:14 exhausting that this is something I have to bring up every couple of years. You'd hope that we'd all learn this by now. It's not like open source is a newfangled thing we've all just discovered, but there's still this disconnect between the consumer slash user slash takers of open source versus the maintainer slash producer slash givers of the community. And the disconnect of how to kind of just communicate with each other is still there. And so specifically when it comes to this stuff with Python, right, is people go like, oh, my God, this is crazy. And it's like, no, it's not. I've been doing this for 17 years. Everything is controversial when it comes to syntax. True and false were controversial, right? Like true and false. There were arguments on Python dev on whether or not
Starting point is 00:39:55 we should add those keywords because they would break code that chose to define those constants as one and zero. Is that why it's capital T? Well, it's also because they're singletons, right? And that's just kind of the practice we follow with none. So that was really kind of where it tied in. I mean, it definitely helped that capital T lowered the chances. Less likely. Yeah, exactly. It's less likely. Yeah. But that was an actual discussion we had, was do we want to add Booleans to the language? Now today, everyone scoffs at that and laughs. Like, what? Are you kidding me? Booleans? Really?
Starting point is 00:40:25 Everything in the language gets debated, right? And in this too, right? Like everyone's going like, oh my God, what are you doing? Like, do you understand the timeline of this? Guido brought this up, I think in July, maybe? And had as one pep, got a massive amount of feedback on Python dev on this, went back with his co-authors, broke it up into three peps, 634, 635, and 636, so that there was a pep about the design, a pep about the rationale behind the design,
Starting point is 00:40:51 and a pep that acts as a tutorial to try to make it more easy to consume. Brought that out in October. We discussed it on Steering Council 2020. We made a recommendation that probably the next one should accept it, but we still didn't feel we had enough time to accept such a large thing. Fast forward now to today, where steering council 2021 had a chance to sit down and look at the recommendation and the peps and have a discussion, including calling Guido in personally at least two times to talk directly to the steering council to help us understand where he was coming from. Like this was not a snap decision, but
Starting point is 00:41:21 everyone acts like it was like, this is literally taking over. It finally appears on their radar and they're like, oh, where'd this come from? Exactly. Oh, it's like on Hacker News today. Suddenly it happened. Like, no, no, no. This has been happening. This has been in discussion actively in public for six months. I first heard Guido talking with someone at a language summit in 2018 about the idea of
Starting point is 00:41:40 pattern matching. Like this has been on people's radar as something people have wanted for that long. And I'll fully admit I wanted it. I pattern matching is something I've wanted for a long time, but it's just, it's just one of these things. Once again, people just don't stop and think about the time and effort that go into all
Starting point is 00:41:54 this behind the scenes. It's just in my worldview, this just happened versus, Oh, there's probably stuff that happened that I'm just not aware of. Yeah. And specifically about this, one thing I always notice about this
Starting point is 00:42:05 is people need to understand the way the language is designed, right? Like we aim to increase your productivity. Now that means different things to different people, but in general, it means keeping a language that's easy to understand and small enough to have in your head, but also leads to you being more productive,
Starting point is 00:42:19 which also means readability, right? There's a lot of side effects that we all appreciate that come with productivity, but that's really the ultimate goal to me. It's not that the language is readable. Readable makes you productive. And for pattern matching, there are certain algorithms that are just really difficult to do without pattern matching, right? Like the classic examples are parsers and compilers, and they're not easy to do without having pattern matching. There's a reason why functional programming languages that have had pattern matching for a very long time are the best places right now to typically write a parser or compiler,
Starting point is 00:42:51 because the algorithm just works so much better that way. So there were reasons why we brought this in. There will be increases in productivity for some people. We do realize that it is a big lift, but we also realize not everyone's going to see this day one, right? This is not, it is way more than a switch statement, which I know a lot of people typically look at it as, right? The key point is it matches on structure. It's not matching necessarily just on value, right? This is the big difference between an if statement versus not. And so there was a lot of
Starting point is 00:43:18 work behind this. So there are reasons, like this was not major. The other thing I keep seeing about this is people going, oh, this is not Pythonic. Well, I hate to break it to people. Well, it is now. Yeah, I hate to break it to people, but Guido van Rossum, the creator of Python, and thus probably the harbinger of what is Pythonic, is a co-author and a big pusher of this pep. Guido helped make this happen. So unless you want to go up to him at PyCon and tell Guido that he doesn't know what's
Starting point is 00:43:43 Pythonic or what's not, I think we kind of just have to go with it that this is now what is considered Pythonic. And I will say, I have seen people say, oh my God, this is what happens when we lose the BDFL. Like the person who was the BDFL made this happen, right? It's a really funny disconnect with people. Like Guido drove this, like Guido talked to the steering council about this. Like he was the point person for this like he really helped make this happen so it's as pythonic as it can be if you consider guido the creator and head person in terms of the design of the language which i will fully i still do i kind of view guido no longer as being bdfl as kind of he relinquished bureaucratic
Starting point is 00:44:20 overhead costs in his life of the language and the steering council is more or less taking that on but i still trust guido's gut more or less like if he really went off the rails we'd stop him but i don't think this is him going off the rails i think this is us going like he's that one step ahead of us um yeah and actually on uh says i just wrote a horrible if lf statement and he's looking forward to pattern matching yeah i mean there there are some real places where i think there's going to be benefits to ways to structure things that will just make things look better.
Starting point is 00:44:49 Yeah, and Magnus says, agrees with me, that Python's full spectrum language and it just extends that spectrum. Yeah, right. It's, yeah, thanks for that, Magnus. It's one of these things I think some people lose track of that being beginner friendly
Starting point is 00:45:02 does not mean only for beginners. And that's where this productivity thing comes only for beginners and that's where this productivity thing comes in that's i think that's actually a huge part of python success right visual basic six was awesome for beginners for example or but it just it stopped like well you can't do that here you you you're at the limit i'm sorry i don't want to be at the limit i want to learn c plus plus don't make me if you want to be beginner friendly go code and scratch right yeah no one wants the right production code and scratch. It's great to get going, but there's a limit.
Starting point is 00:45:29 One of the great quotes that I've heard that I think applies to Python is that you can do easy things simply, but you can do difficult things that are possible. And I know I got that quote wrong, but... It's definitely close enough that I'll just go with it. That is very true like that is the goal here is to make the the common things easy and simple and make and
Starting point is 00:45:52 definitely approachable and make the hard things at least possible and this is part of it this opens up the possibility for things that were really difficult to do in python before it yeah fantastic so yeah so i'm thinking of doing a blog post about this whole rant called the social contract of open source to try to harp on this whole should versus need and just, it's okay. It's, I, constructive criticism is totally acceptable. It's just be understanding about how you're delivering it
Starting point is 00:46:15 because we're all on the internet. We do hear it and indirectly you will suffer because guess what? That project you're using is gonna then suffer based on what you say. So it does matter. Yeah. And just one aside, I think last podcast,
Starting point is 00:46:28 Michael said this was influenced from Haskell. It was actually, the design comes a lot from Scala, specifically for this. But we got this comprehension from Scala. So we have actually gotten some nice things out of Scala. Interesting, yeah, okay, very interesting, yeah. Yeah, I mean, my feeling is it's a big step, I think.
Starting point is 00:46:47 It's going to take a while to really see the value of it if you're not working directly in a place where it's one of these algorithms that applies a lot, but I think it'll be good. Yeah, it's definitely
Starting point is 00:46:59 one of those things that when you see it for the first time, if you're not used to using like a language, like most functional languages that have pattern matching, it goes like, what like what why and then when you get exposed to when you start to use it more it starts much like learning another programming language it starts to tweak
Starting point is 00:47:13 your approach to certain algorithms and stuff and it's just it's another tool in your toolbox really nice well brian you've got the the follow-up huh So, um, actually that's why I thought this would be good as a, as a follow-up. So, um, Guido announced, uh, that he wrote, um, the introduction to, uh, pattern matching and, and that it's, it's now part of, um, it's part of an appendix A of PEP 636. So I went off and looked at it and it actually really helped me a lot so this um this introduction kind of i actually i've been trying to follow this pep and honestly been confused for a while as to like exactly how it's working a lot of people have been focusing on the weird parts but the easy parts actually are really nice so i really the the there's an example that it starts off with that kind of looks like a switch statement
Starting point is 00:48:05 right so it's a i want to match a status and like an http status and then i do something different based on 400 or 404 or 418 and then and then of course we're like well what about default right so there's going to be some sort of fall through that i handle all the other cases and there's an example of that and i was actually curious The example here shows using just a single underscore variable, magic variable, as a catch-all. And so Brett, I was just curious. Can I use any variable here, or does it need to be the single underscore?
Starting point is 00:48:39 Do you know? So I was actually going to comment on this when you were done. So the underscore actually has some special semantics here because in most languages that have pattern matching, the underscore represents the wildcard. This has actually been one of the most controversial parts of PEP 634 was the selection of this to stay consistent with other languages.
Starting point is 00:49:00 While I will not suggest to people that there is an opportunity to remove pattern matching or to necessarily have massive changes to it. One of the things that if people try this out in real world code and can get feedback to us well before beta one locks in and gets released, because that's our cutoff for feature changes for Python 310, which will be in May. This is one of those areas where we could actually consider changing, right? Like fixing up code to change this case wildcard syntax of an underscore to something else is totally possible if we got feedback from the community that, yeah,
Starting point is 00:49:36 this really was a nasty sticking point and really didn't work out well. So I do wanna say that there is still a chance to potentially influence the final outcome of how the exact thing is, although I don't to say that there is still a chance to potentially influence the final outcome of how the exact exact thing is. Although I don't want to suggest that because it's not shipped in 310 yet. Right. Exactly. It's not shipped in 310 yet. So we can tweak if necessary, but don't come out.
Starting point is 00:49:56 I wouldn't suggest people come out and try to completely rewrite the entire syntax. But in this specific case, yes, it is special. Yes. Some people don't like it. And if enough people really came forward and really said, this is the one thing I'd want to tweak, I think we'd be open to considering tweaking. Well, the underscore gets used so much for so many interesting things. Like, why not one more?
Starting point is 00:50:17 I'm okay. I personally, I don't care. I just want to know what it is. I mean, I didn't like spaces instead of braces when I first't care. I just want to know what it is. I mean, I didn't like spaces instead of braces when I first hit it. So anyway, but what happens if I put like X there instead of underscore? If you put X, so the rules here basically are if you put a single name that has no dot in it, it's a binding. If you put a name there with a dot, it will be a binding. Now, this is one of the things that I learned from, this is one of the things
Starting point is 00:50:45 that I learned from Guido in one of our meetings that really helped clarify this for me. And one of the reasons I ended up voting to accept this was let's look at the, like consider these cases, right? Return codes.
Starting point is 00:50:55 You're probably not going to hard code 400 and 404 and 418. You're going to import the HTTP.status module and you're going to specify the constants from there, right? Yeah. Do you really want to rebind
Starting point is 00:51:04 those constants by accident in your code? Oh no but because it's been imported from a module in or off a class for instance you're not going to be wanting to do assignment you're just going to want to reference it so if there's a dot in the name it automatically is just a reference now some people get really hung up on that when they think about the single binding of a name understandably but here's the thing is, while this is a case right now where if you had just a bare name, that's a bind, where if there's a dot in it, it's actually going to be a reference and a load to do a value check. There is a potential in the future if people come back after trying out the PEP and having experience
Starting point is 00:51:42 with pattern matching to add to the language a leading dot, which is actually used in Swift, by the way, in the Swift community for something else. But the key point is we can make it like a dot X to act as a load for comparison for a local name. That's an interesting syntactical use. It's not actually coming from anywhere, but treat it as if it were. Exactly.
Starting point is 00:52:04 Now, this was originally in the pep and there was massive pushback uh from people thinking that they would totally miss the dot um but uh cory benfield who i used who helped used to run requests and all that and has uh multiple talks from pycon um person who helped me start pushing sans io development of libraries in the community uh he's he works at apple now on swift stuff and he posted something on twitter and i asked him like hey does that leading dot have any problems with swift and they said actually the whole community is totally fine with it there's no readability problems it just totally works okay so we could potentially in the next version of
Starting point is 00:52:37 python actually make it so that that that have it a dot in the name whether it's just leading or not we could actually generalize that but because it's a forward compatible thing and backwards compatible, we decided not to do that in this path and just try to just keep it simple. Simple. Keep it simpler than it had to be necessary to go out and then add the opportunity. So if I just put a bare X, it's going, will it hit it and will it bind to it and assign the value to X? Yes.
Starting point is 00:53:06 Okay. Actually, that's what I expected because as i go down this little tutorial it talks about like um uh unpatterned like unpacking which is totally cool so let's say you have uh like a the example is a point object which is like just an xy tuple um now i want to be able to if i in the the case statements are you know specific points that you're going to match to or like let's say you don't care what x is but you you want to fix y at zero in in the case in the case block you want to know what the value of x was so you do want that binding and that's that's really just cool i just um i can't wait to play with this so my my follow-up question i'm glad you showed up here is when can i play with this is this in one of the alphas now or betas or do you know i don't there's i don't know if it's i
Starting point is 00:53:56 don't think it's landed yet um brand butcher who's one of the co-authors of the pep has a working implementation already which was which is actually available in a Jupyter, was available in a Jupyter notebook somewhere. So there's definitely a fork somewhere where you can try this out. Okay. But I don't, this is not landed in mainline, so it's not out in an alpha quite yet.
Starting point is 00:54:17 Okay. One thing I did want to point out about this that's really kind of cool, with the example that Brian's showing here, right, is the match against a point argument, as you said, that takes a two-item tuple, right? You could actually change this to also accept a single-item tuple
Starting point is 00:54:31 that represented X and Y with the same value, and that would totally match separately as well, right? So once again, this is matching against structure. So you could actually pass in tuples of different sizes and have it automatically just kind of infer based on the shape. Maybe do something different with 2d or 3d yeah exactly yeah exactly so because it's a structural thing and not a value thing it opens
Starting point is 00:54:52 those very interesting doors interesting yeah cool it's really great to have you here to talk about all this stuff uh final comment close this one out i guess zdoc says i think one's good syntax highlighting lands this will be as natural as this conversation. Yeah, and that's actually a good point. One of the things we had discussed was, like, the leading dot would, how hard would that be to see with or without syntax highlighting?
Starting point is 00:55:15 And we realized that, honestly, syntax highlighting will probably do it. One thing some people were a little worried about was, the reason this is even possible was because of the new parser that landed in Python 3.9, the new pgem parser. It can do more contextualized parsing. So that match, for instance, isn't going to suddenly make all your match keywords or the
Starting point is 00:55:33 match method from the RE module on match objects suddenly not work. It contextually can tell that that match keyword is for a match statement. So there might be a little funky coloring for some people based on how your syntax highlighting works. Like you might suddenly have all your match methods highlighted like it was the match keyword. But honestly, it'll be from what you're looking at in terms of code, it's going to be fairly obvious that is not a match statement.
Starting point is 00:55:56 So we weren't too worried about that kind of haziness as it were when it comes to syntax highlighting. Yeah, no, this is cool. I know a guy on the VS Code team, so. Yeah, so do I. You see him every morning in the mirror. A quick plug and thank you to Magic Python, which comes from the Magic Python team,
Starting point is 00:56:17 Magic Stack, the people who do EdgeDB. They actually maintain the syntax highlighting that we use in VS Code, as well as I think is using some blind text and add them. They have a generic grammar that they use that they just auto-gen out to various editors for their syntax, mostly
Starting point is 00:56:33 text format, but kudos to them for always maintaining that syntax highlighting because that's actually what VS Code itself ships in the box. That's awesome. Yeah, nice. Brian, I don't have any extras. Do you? I don't know. Brian, anything else you want to throw out there before we make a bad joke?
Starting point is 00:56:50 No, just thanks for having me on. Thank you for everyone listening to me rant on about how to please try to talk to maintainers to help them keep their sanity. And that's it. I hope people give the Python launcher a shot and it works for them. Yeah, that's very exciting. Let me know.
Starting point is 00:57:05 I can't make any promises about it shipping specifically with Python, but at least it's a tool there that I find useful and I hope others do as well. Cool. I'll definitely check that one out. All right. You guys ready for the joke? You know, we're all stuck at home. And especially if you're single, it's really tricky to get out and meet people and, you know, whatnot. See what's going to make you happy.
Starting point is 00:57:25 So I got a joke along those lines to kind of help people out there. Ready? Mm-hmm. All right. So there's this tweet by Christiana Zhu. It says, if you're not happy single, you won't be happy in a relationship. I mean, we've all heard this, how important it is to be just content with yourself. She says, no, true happiness comes from closing 100 chrome tabs after solving an obscure programming bug
Starting point is 00:57:45 not from other people come on yeah anyway i thought that was good and kiki are you two the type of folk who have like a bazillion tabs open at any one time or are you more like i'll only keep open exactly what i'm working on as soon as i'm done i close them i'm not a hundred tab person but what i do sometimes i I'll leave the tabs open. Like, oh, I'm not done with this. And so I'll close it. If I've got to reboot the computer, the first thing I do is reopen the browser and say, history restore previous session.
Starting point is 00:58:14 Because I'm like, there were things in there. I don't know what I was doing, but I know they're important. So I may abuse that a little bit. My daughter came to me once and said, I need, Dad, like, finals. And my laptop is too slow. I need a new laptop. Like, okay, well let's talk about what you're doing. Well she was doing like three research projects and had like a hundred dabs open. I'm like, well, let's just try this first. Can I,
Starting point is 00:58:36 can I tell you about this cool thing called bookmarks? Um, anyway, totally fixed it. So yeah, that's awesome. Hipster dad showing bookmarks to the youngsters. Yeah. Magnus says, uh, the number of tabs is a measure of how hard the problem is. And, uh, Niels says, uh, great rant. Love your work, Brett.
Starting point is 00:58:57 Great to have you on the show, Brett. I always happen to be on. Thanks for being here. Thanks everyone. Brian. Thank you. Thanks as always. Bye all.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.