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


Transcript #155: Guido van Rossum retires

Return to episode page view on github
Recorded on Wednesday, Oct 30, 2019.

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

00:05 This is episode 155, recorded October 30th, 2019.

00:10 I'm Brian Okken.

00:11 And I'm Michael Kennedy.

00:12 And this episode is brought to you by Datadog.

00:15 Thanks, Datadog.

00:15 We'll hear more about them later.

00:17 Absolutely.

00:17 Brian, happy Halloween Eve.

00:20 Oh, right.

00:21 Halloween Eve.

00:21 Spooky.

00:22 I have big news.

00:24 It's not my big news, but I have big news to announce.

00:26 I'm on pins and needles.

00:28 Guido has retired officially from employment, which, you know, congratulations to him.

00:34 That is awesome.

00:35 The news is Guido Van Rassen has left Dropbox, not for another position, but to retire.

00:41 So, you know, I think that's great to hear.

00:43 Okay.

00:43 What does that mean about his involvement in Python?

00:46 Do you know?

00:46 I can only speculate.

00:48 I don't know for sure yet, but my guess is actually that it will mean more Python involvement, not less.

00:53 Okay.

00:53 But that's just based on, I've been at big companies.

00:57 And even when they say, yeah, you can work on whatever you want.

01:00 There's meetings and there's bureaucracy and, you know, the proverbial TPS report.

01:05 He's just like, you know what?

01:07 Okay.

01:08 We're doing nothing today.

01:09 And so if he can work on whatever he wants, I have no idea what he's going to work on, but

01:13 there's got to be some cool creative projects.

01:16 Maybe not next week.

01:17 Maybe he needs a year just to sit on the beach and look at some sunsets.

01:20 But then eventually, I bet he will come back, do something.

01:23 Yeah.

01:24 Okay.

01:24 He deserves a break.

01:25 And you're linking to an article or a post where he announced it also, right?

01:29 Yeah.

01:30 So there's a link to his announcement where he wrote, you know, sort of the goodbye and all that.

01:36 You know, his final project there at Dropbox was really to work on MyPi and help them convert to two to three.

01:42 I think it's kind of fitting, right?

01:44 Like one of his final things is to convert one of the largest Python code bases from Python 2 to Python 3 to kind of like close that gap.

01:52 I mean, not globally, but at least in that realm.

01:55 Right.

01:55 You have a, not just his announcement, but a thank you Guido from Dropbox.

02:00 That's kind of cool.

02:01 Yeah.

02:01 So when I wrote this stuff down, it was just, I don't know, half an hour since that news came out.

02:06 And it was just full of responses of so many things.

02:09 So I just grabbed a couple to, you know, I thought maybe a nice way to close out this little section is just to read some of the messages that people wrote to Guido.

02:18 Okay.

02:18 On his Twitter announcement that linked to his full post.

02:22 So, Lucili says, thank you for Python and helping to increase diversity in the teams that you worked with.

02:30 Enjoy your retirement.

02:31 Dharan Liao says, congratulations and best wishes.

02:35 Thanks to the many contributions to open source software and for inspiring me.

02:39 Philip Guo, congrats and best wishes on the next era.

02:43 Someone just goes by Steve.

02:44 Thank you for your contributions to the world.

02:46 My boy was just learning how to code Python as his first programming language as I read this, basically.

02:51 And Freeman Croach, best wishes.

02:54 I literally don't know what my teaching career would have been like without Python.

02:57 Wow.

02:58 I just want to say thanks for everything, Guido.

03:00 That's awesome.

03:01 He's really created something special and he's put a big dent in the universe, obviously.

03:06 Right.

03:06 This is a huge accomplishment of what he's done and what he's shepherded over the last 30 years.

03:11 And it's definitely high time for him to retire just so that he can go and just enjoy that, not stress.

03:16 Like, it's cool that everything is in place that basically this is not like a, oh my God, now what?

03:23 It's just like, oh, okay, well, that's great for him.

03:25 Right.

03:25 Like, we kind of went through that last year, actually.

03:28 Yeah.

03:28 It's an interesting thing.

03:30 And yeah, I don't know what more to add other than also thank you.

03:33 Yeah.

03:33 I love the language.

03:34 We both get to work on some really awesome stuff involving Python.

03:37 Yeah.

03:37 And the community because of it.

03:39 So, yeah, thanks.

03:40 All right.

03:40 Well, speaking of awesome stuff built with Python, what's the next?

03:44 Yeah, hard to transition away from that.

03:46 But I could have swear we'd covered this, but I guess we haven't.

03:49 There's a cool project called Selenium Base.

03:52 And what Selenium is, I mean, most people know it because in the Python community or other places for testing websites and such.

04:03 You can also test APIs with it.

04:05 But the Selenium WebDriver is what people often use to access Selenium through Python.

04:12 And Selenium Base is built on top of that.

04:15 And it's built in conjunction to work with, it works with other things like unit test stuff, but it works best with pytest, of course.

04:23 And it's kind of a layer on top that makes it quite a lot easier to, the Selenium WebDriver right out of the box has a lot of access.

04:31 You can control, basically, you're driving a web browser through from Python.

04:36 And the Selenium Base just makes it easier.

04:39 There's a lot of easier things.

04:41 Like, I'm going to link to, actually, in the show notes, I've got a little snippet of code.

04:47 And it's really easy stuff like open a web page or open with a URL and assert that a title is there.

04:53 And, you know, click on elements.

04:55 And you can use go back and click and examine things and assert stuff.

05:01 It definitely makes for testing.

05:03 Testing web pages is a lot easier with all these utilities.

05:06 But I also wanted to highlight, there's some, I was looking through it the other day, and there's some other things that it does that I thought was kind of interesting.

05:13 One of the things that it has is, well, one, it has support for a lot of the major continuous integration services.

05:19 It also has a plug-in built into it that you can take screenshots of test results.

05:25 So let's say you have a test that fails because, you know, something isn't in the title or something isn't present or something's wrong.

05:31 But what is there?

05:33 And it's hard to describe with code, but it's not too bad with a screenshot.

05:37 So it has the ability to take a screenshot on test failures.

05:40 That's pretty cool.

05:41 I wonder if you could use that as an assert itself.

05:44 If you had a screenshot of the way he said, this page looks right now.

05:50 And if something goes crazy, like the CSS won't load or something is, like,

05:54 could you assert that the pixels are the same?

05:56 I mean, that's sort of visual testing.

05:59 Yeah.

05:59 There is some visual testing with it.

06:01 The main component that it has with it is making sure that the DOM is essentially identical.

06:07 The DOM essentially reproduced the same thing.

06:10 I don't think it does a pixel by pixel comparison.

06:13 Maybe there's some plug-in for it.

06:15 But there is some built-in stuff to do.

06:16 Basically, it should be about the same.

06:19 Some other cool stuff.

06:20 It works with Selenium Grid, which I wasn't quite sure what this was.

06:23 But Selenium has built-in an ability to run Selenium tests on multiple CPUs so that you can do things in parallel.

06:31 Grid computing.

06:32 I want to test all these pages, and it takes a little while.

06:34 So just spread it out.

06:36 Yep.

06:36 Okay.

06:36 That's cool.

06:37 I hadn't heard of that either.

06:38 That's nice.

06:38 The other thing is assisted QA.

06:40 So sometimes it's really easy to have a manual procedure that basically says, you know, we want to throw this together quickly.

06:47 Just look at this page to make sure the graph is there.

06:49 Sometimes it doesn't show up.

06:51 Or, you know, whatever.

06:52 Just make sure.

06:52 And then pop up a little dialog box that says, yes, it's there.

06:56 There is some assisted QA.

06:58 So it's like partial automation.

06:59 And that's kind of neat.

07:01 And I think people poo-poo this too much.

07:03 This is actually very powerful to have in place.

07:06 And sometimes it's a matter of pragmatism of getting things done.

07:10 So this is cool.

07:11 And then one of the other cool things is it has onboarding demos capabilities.

07:15 So since you're using it to drive a web browser, you can use it to highlight things and pop up messages.

07:23 And you can essentially give a kind of an onboarding demo of like how to use a web page.

07:29 So this isn't a testing sort of thing.

07:31 You would create a little demo to show somebody how to use some service.

07:36 So that's kind of neat.

07:37 Yeah, it's super cool.

07:38 This looks really nice.

07:39 I looked at the API that you got here.

07:41 Like if you knew the tiniest bit of programming and you knew CSS, you already understand this.

07:48 It's like there's no documentation needed.

07:50 Obviously, you've got to have some documentation for real.

07:52 But it's super clear.

07:54 It takes away all of like the find item by element and all those sorts of things.

07:59 You don't have to do that too much.

08:01 So anyway, cool thing for if you want to automate a web browser or test a website, make sure you check this out.

08:08 It's good.

08:09 Yeah, it looks great.

08:10 I love it.

08:10 Nice find.

08:11 Well, another thing that's nice is Datadog.

08:14 So this episode is sponsored by Datadog, a cloud scale monitoring platform that unifies metrics, logs, distributed traces, and more.

08:22 Trace requests across service boundaries with flame graphs, correlate traces with logs and metrics, and plot the flow of traffic across multi-cloud environments with network performance monitoring.

08:35 Plus, Datadog integrates with over 350 technologies like Postgres, Redis, and Hadoop.

08:41 And they're tracing client auto instruments, common frameworks, and libraries like Django, Tornado, Flask, and AsyncIO.

08:47 That's cool.

08:48 So get started today with a 14-day free trial at pythonbytes.fm/Datadog.

08:54 Yeah, check them out.

08:55 Big support of the show.

08:56 Thank you, Datadog.

08:57 Yeah, plus I love my purple t-shirt from them.

08:59 It's good.

08:59 For sure.

09:00 Now, this next one, I want to start by asking you a question, Brian.

09:04 You've done a lot of C, C++.

09:05 We even talked about that last time, right?

09:07 Yes.

09:07 Is Python slow?

09:08 No.

09:09 People are slow.

09:10 People are.

09:10 Very good.

09:11 That's a good question.

09:12 Or a good response.

09:13 I like it.

09:13 I think the whether or not Python is slow is a really interesting question.

09:16 And people sometimes say, well, I did a tight loop and I added x plus equals one.

09:22 And it was slower than if I did that on C.

09:24 And so Python is slow, right?

09:26 But then you could also say, well, I have a job.

09:30 Somebody told me to implement this feature.

09:32 If I started in C, I would be done in 10 days.

09:34 If I did it in Python, I'd be done in six hours.

09:37 And it took one minute to run in Python and 30 seconds in C.

09:41 So Python is way faster, right?

09:43 It's half a day or three quarters of a day instead of 10 days.

09:47 Yes.

09:47 That sort of analysis.

09:48 But sometimes it's interesting just to compare directly to these things.

09:52 And we also have the C layer.

09:54 So yeah, sure, it might be slower than some languages.

09:57 But then if you call it NumPy, then it's probably faster than most languages.

10:00 There's all these interesting angles, right?

10:02 Cython and whatnot.

10:04 But this thing that I want to talk about now is this host mortem done by Darren Moffat.

10:09 So he re-implemented the list users command on Solaris.

10:14 It was originally written in C.

10:17 And he rewrote it in Python.

10:19 Okay?

10:20 Which is kind of an interesting thing.

10:22 A couple of stats about it.

10:24 So this is from like 19.

10:26 The last time the C code was touched was like 1988.

10:30 That's 30 years ago, 31 years ago.

10:34 That's a good long while.

10:36 And the implementation of this was about 800 lines.

10:41 And it was written in a time when the number of users were small and things like that.

10:46 So it didn't have to deal with tons of data.

10:48 And it even had some bugs, right?

10:51 But it turned out that the basic implementation of what list users does is a set manipulation.

10:56 Okay.

10:57 You know what language has a really good set implementation?

10:59 Python.

10:59 Indeed.

11:01 So he decided to try to rewrite it in Python.

11:04 And it turns out the rewrite of list users in Python 3 was about a tenth the number of lines of code.

11:12 Instead of 800 lines of probably fairly gnarly C code, it was down to 80 lines of Python.

11:18 Wow.

11:18 That's pretty awesome.

11:19 And a lot of the reason has to do with the fact that like you don't have to reimplement set.

11:23 You just, you know, say the word set and you're good.

11:26 But what's really interesting is on top of that, for 100,000 users, some tests they were doing,

11:33 the Python version was 17 times, 1,700% faster than the C code as well.

11:40 Wow.

11:40 That's incredible.

11:41 Pretty cool, huh?

11:42 Yeah.

11:42 It's actually not surprising to me.

11:44 I'm glad we're covering it because it sure should surprise some people.

11:47 Yeah, it doesn't surprise me all that much either.

11:49 So yeah, it's pretty interesting.

11:51 It turns out that it's source open but not open source if you want to look at the implementation.

11:57 What I mean by that is the list users command is, you know, this is from Oracle, right?

12:03 Like they bought Sun, so now they have Solaris.

12:05 So on 11.4, SRU 9 or higher, you could just go to slash user slash bin slash users and it's a Python file.

12:13 So you just look at it, right?

12:14 So you could see what they're doing and you could compare the code and whatnot.

12:17 But it's not open source and it's covered by the Oracle Solaris license.

12:21 So you can check it out but it's not open source.

12:24 It's sourced open.

12:25 This is cool.

12:26 So not only is this, somebody tried to do it and it was faster.

12:29 It also is shipping now with Solaris.

12:32 Yeah, that's pretty awesome.

12:33 And it's Python 3.

12:35 Of course.

12:35 Of course.

12:36 I bet there's some useful tricks in that code.

12:38 There probably are.

12:39 Actually, I was thinking about this when you brought it up with sets.

12:42 So I admit it.

12:45 I am capable of getting link baited by the occasional listicle.

12:48 And this is definitely one of them.

12:50 It was 20 useful Python tips and tricks that you should know.

12:54 Now, there's some fluff in there that I don't think that's useful.

12:58 But there's a whole bunch of enough that are useful that I think it's a good thing to take a look at.

13:04 Like for one, I'm not sure if – so change assignment is one of the first ones that I looked at.

13:10 And you actually don't – I don't see this in a lot of Python code.

13:15 So is it like bad Python style or something to have like X equals Y equals Z equals 2 or something?

13:21 Do you know?

13:22 I don't know, actually.

13:23 But you're right.

13:24 I remember seeing this a lot in C.

13:26 Yeah.

13:27 But not a lot in Python, no.

13:29 No, but it does work in Python.

13:30 But I guess make sure that you're not doing something that's too unclear.

13:34 I highlighted that mostly because what I do see, what I use a lot is chain comparison.

13:40 And people coming from other languages don't know you can do this.

13:44 So, for instance, in C, if you wanted to have – make sure that X was between 2 and 8,

13:49 you'd have to go 2 is less than X and X is less than 8 or something.

13:54 But with the Python, you can just chain them together and put them together.

13:57 Right.

13:58 Like 2 less than X less than or equal to 8.

14:00 Yeah.

14:00 And you can have a whole bunch of them.

14:02 So you can have like a couple variables within ranges and stuff.

14:06 It's nice.

14:07 Multiple assignment, which I think of as unpacking, I guess.

14:11 Yeah, I think of that as tuple unpacking.

14:12 Definitely that's common, right?

14:14 Like if you're going to do a 4, you know, index, comma, value, and enumerate of collection.

14:20 Something like that.

14:20 Yeah, but the thing that I've been using a lot more lately is tuple unpacking with the star operator.

14:26 So, like if you put a star on one of the things you're unpacking to, it takes all the leftovers.

14:33 And so if you've got a whole bunch of stuff you're unpacking, but you only care about a couple of them, you can name those and then just capture all the rest of them in like a star underscore or something.

14:43 Yeah, then throw away.

14:44 Like I know I have to have a placeholder for this, but I just don't care.

14:47 I've seen it in a couple articles, but it listed merge dictionaries where you do star star of both dictionaries within another like dictionary in brackets.

14:57 And that kind of combines them.

14:58 Yeah.

14:58 Debate as to what you should use.

15:00 But I kind of like that because it's short.

15:02 I like that one.

15:03 Yeah.

15:03 Yeah.

15:03 And then joining strings, people new to Python, it's one of those things that it's nice to, you just take a character or a string and join all the elements in a list or any iterable.

15:15 And this is something that for some reason, especially the people I'm familiar with that come from C or C++ to Python, this is hard for them to get around that strings themselves have object methods on them.

15:30 Isn't it just a character pointer or something like that?

15:32 Like car star, charge star sort of.

15:35 Yeah.

15:36 Yeah.

15:37 They don't think of them as objects.

15:38 Exactly.

15:39 This brings up you said sets before.

15:41 So if you've got a list of things and you want to get the list of unique things, well, you can just convert it to a set and then back to a list.

15:49 And there you go.

15:50 Yeah.

15:50 I do that sometimes.

15:51 It's really nice.

15:51 That's your distinct.

15:52 Yeah.

15:53 Yeah.

15:53 The only thing left that I wanted to mention was using this was something that was difficult for me to get to get my head around.

16:00 was the zip function, mostly because I was familiar with using zip on the command line to actually zip files.

16:06 So no, zip is completely different.

16:09 It kind of pair-wise is up all a bunch of lists of things.

16:13 And I use it all.

16:15 I know really it's hard to explain when you use it, but when you do need it, it's really handy.

16:20 Yeah.

16:20 I feel like the inner tool stuff just has so many things.

16:24 It's always something new to me, you know?

16:27 Yep.

16:28 I'm like, I don't know all this stuff.

16:30 Those are the things I thought were good.

16:31 And it was less than 20.

16:32 The rest of the 20 wasn't that useful to me, but these were neat.

16:37 Yeah.

16:37 No, those are really cool.

16:38 And a lot of times with these listicle type things are like this top 10 or like, I don't know.

16:42 Some of these are cool or whatever.

16:44 Like these all look really great.

16:45 Yeah.

16:45 I like it.

16:45 Yeah.

16:45 Cool.

16:46 So let's talk about waterfalls.

16:48 Okay.

16:49 Now, we've talked a little bit about code complexity on different things.

16:53 I think we've covered Wiley from Anthony Shaw, which is a code complexity analysis tool.

16:57 So here's an article right up sent over by Arem Aref.

17:03 The article is by somebody named Nikita Sobolev.

17:08 And it's called Complexity Waterfalls.

17:10 Pretty interesting.

17:11 It kind of talks about the origins of complexity in our code and just the challenges of how that sneak in.

17:17 And nobody starts out with the intention of writing like bad, hard to understand code.

17:23 You may know you're going down that path.

17:25 He's like, I don't know what I'm doing here.

17:27 But most of the time, it's with good intentions that everything starts out.

17:31 But at some point, it becomes this mess, right?

17:35 Yes.

17:35 Some people are really good at it, too.

17:37 They do have a special skill.

17:40 So this article highlights some of the types of complexity that you might find, how you might address them, some of the tools to actually automatically discover them.

17:50 Two of the core ideas are things that I think will resonate with you, Brian, are continuous refactoring and architecture on demand from using things like tests and continuous integration and whatnot.

18:03 So basically, instead of trying to dream up this perfect architecture, just write stuff in a simple way.

18:09 And as it gets more complex, run some tools, discover the problems, use your unit test to let you refactor and grow the architecture out of it.

18:17 What do you think of that?

18:18 Yeah, I definitely like that a lot.

18:20 And more and more, I'm warming to the idea of using complexity measurements as part of your tools to tell you where to refactor.

18:29 Yeah.

18:29 So one of the things they use in here to talk about the complexity and measure it is this thing called we make dash Python dash style guide, which is actually a linter, not just a guide.

18:41 It's a thing you could run, I believe.

18:43 It actually outputs stuff.

18:45 It's not just a guide.

18:46 And it does pretty interesting stuff.

18:48 So you can run it on your code and it'll say, you know, you're missing white space between your type definition and your type, your variable definition and your type annotation or between a comma or, you know, there's a bunch of different things.

19:03 Right.

19:03 And it brings in some of this, these complexity measures.

19:06 I've heard of, you've heard of psychomatic complexity.

19:09 I know we've talked about that, right?

19:10 Yes.

19:11 We've definitely spoken about lines of code, right?

19:14 Like when the article talks about, hey, here's how individual lines of code become complex.

19:20 Here's how functions become complex or classes or modules or packages and so on.

19:26 And obvious measures or metrics would be if your function is 5,000 lines long, it's wrong.

19:35 I don't know what it does.

19:36 I've never seen it, but I can tell you already it's broken, right?

19:39 Yep.

19:39 These sorts of things are pretty, pretty obvious.

19:42 But one that I don't know that I've ever really paid attention to is something called the, I think it's the Jones, the Jones metric.

19:50 Yeah.

19:51 Jones complexity.

19:51 No, I've never heard of this.

19:53 Yeah.

19:53 So here's the idea.

19:54 Like if you had a line that was 80 lines long, like says, the example they give in the, that Keto gives in the article is by print three long variable names.

20:03 Yeah.

20:04 Yeah.

20:04 Yeah.

20:04 Yeah.

20:04 Yeah.

20:04 Yeah.

20:04 Yeah.

20:04 Yeah.

20:04 So first long name with meaning, second long name with meaning, the third one, and that's 80 lines.

20:09 Or if you say print three calculations, right?

20:13 Like you actually compute three or four things, right?

20:16 Multiply, divide, whatever, multiple things in each of those print, you're still printing three values, but somehow they feel more complex.

20:25 So with the Jones complexity, what it measures is it's like, if I were to take this line of code and parse it into an abstract syntax tree, how many nodes would there be?

20:35 Oh, wow.

20:36 Yeah.

20:36 The first one, there's like four, like we have print and then there's the three things we're printing.

20:39 The other one is like 21 different things are participating in this one line.

20:45 Yeah.

20:46 Right.

20:46 So the reason I bring that up is, for example, the we make thing, I believe will like tell you this has too high of a Jones complexity.

20:54 Right.

20:55 Yeah.

20:55 There's too much.

20:56 It's a line.

20:56 Yeah.

20:57 It says, it'll say things like, we found a line with a high Jones complexity of 15.

21:01 This is an error.

21:02 What should you do?

21:03 And well, what should you do?

21:05 You should break those out into different variables, right?

21:08 You should take those expressions and turn them into three variables and then print them like three variables, one on each line and then print them.

21:14 So there's a lot of concrete little steps about how do you go through and see this complexity?

21:19 What do you do about it?

21:21 And like, how do you kind of evolve your architecture through it?

21:24 So, you know, I don't want to go through all the details in there, but it's a pretty interesting read and it comes up with some good ideas, including pointing out this.

21:33 We make Python style guide.

21:36 One of the things I want to highlight when we're talking about this is that a lot of times it is shifting complexity.

21:42 So, yes, you'll have a very complex bit of something and that's a danger field.

21:46 But to eliminate it, you're going to add complexity somewhere else.

21:50 Because like the example of a 5,000 line function, that's bad.

21:55 But so is 5,000 two line functions that are 5,000 functions deep.

22:01 Sure.

22:02 Yeah.

22:02 If you were to break it into 10 lines, you might end up with a module with 500 functions.

22:07 That's also a bad thing.

22:08 Right.

22:08 And so that's one of the things that I like about these tools is that you can break things out the way you think it's better and then measure it again.

22:16 And also, please have tests in place to make sure that you're not breaking your code while you're refactoring.

22:21 Yeah.

22:21 So one of the things that Nikita talks about is this iterative, continuous refactoring stuff.

22:28 Like, okay, we fixed the Jones complexity of this, but now we've actually changed the complexity of, say, the module.

22:34 How do we fix that?

22:35 Right.

22:36 Like, keep doing it until it gets better.

22:38 Right.

22:38 Yes.

22:39 And I love this because the idea, maybe some people can just think of the right architecture that they're going to need at the end.

22:45 But I never can.

22:46 And so starting small and building up and refactoring where needed, that's the only way I know how to work.

22:53 Well, usually the challenge is you don't have a perfect understanding of the problem you're solving until you're halfway through it.

22:59 Right.

23:00 Well, usually not until I'm completely through it.

23:02 Yeah.

23:03 Yeah, for sure.

23:04 So even if you try to think like, well, maybe I should be more patient.

23:07 I'm going to really think through this.

23:08 Well, maybe.

23:09 But the way you figure out what the solution should be is by going through that step.

23:14 And then there's this iterative fixing process.

23:17 Well, I never understand why some coders and developers think that they really can architect the right solution to begin with.

23:25 It's like expecting a novelist to not write a first draft.

23:28 Yeah.

23:29 To just come up with the final draft at the end.

23:31 It just doesn't work.

23:32 Yeah.

23:32 Even if it can be done, it's probably not the most efficient way to do it.

23:36 Right.

23:36 You just stare at the wall for a week.

23:38 You're like, you know what?

23:38 I wrote it badly in three hours.

23:40 I fixed it in one.

23:41 I went to lunch.

23:42 Right.

23:42 We're good.

23:42 Exactly.

23:43 For sure.

23:43 Cool.

23:44 Well, if they give you care about code complexity and this kind of stuff, this is a pretty good write up.

23:48 And definitely some of the tools mentioned are interesting.

23:51 There's usually advice at each level.

23:53 Like, here's what you do to make a line less complex.

23:55 Here's what you do to make a function less complex.

23:57 I think the advice is generally good, but it can't be taken absolute.

24:02 Absolutely.

24:03 Right.

24:03 Like, it talks about, well, if I have a function, fewer arguments is better.

24:08 If I have a class, fewer methods and fewer fields is better.

24:11 But if you push that to its extreme, you say, well, all my classes have only one field and one public function.

24:17 Like, well, okay.

24:18 It's kind of, you know, now you have a thousand.

24:20 Like, you can't push it to its logical extreme.

24:22 Right.

24:23 It's kind of a give and a take.

24:24 But it's, you know, it points in the right direction, I would say.

24:27 Yep.

24:27 I only have one argument to every function.

24:29 It happens to be a variable length tuple, but.

24:32 Exactly.

24:34 Yeah.

24:34 Cool.

24:35 That's called tuple complexity.

24:36 Tuple complexity.

24:37 Yeah.

24:37 Is that in the list?

24:39 No, it's not, but it is now.

24:40 I'm adding it.

24:41 Have we ever talked about GUIs on this podcast?

24:44 We should totally cover that because Python needs to have more cool GUIs.

24:48 I think so.

24:49 So this one came up recently.

24:50 It's, I don't know how to pronounce it.

24:52 P-L-Y-N-T-H.

24:54 Plinth?

24:55 Plinth?

24:56 I'm going to go with plinth.

24:57 Plinth.

24:58 I could be wrong.

24:58 And I don't mean to make fun of you.

25:00 Plinth.

25:01 I think what it's cool.

25:01 What it is cool.

25:03 So it's a GUI framework for building cross-platform desktop applications with HTML, CSS, and Python.

25:09 Hey, we asked for this.

25:11 But it looks pretty cool.

25:13 It integrates with the standard CPython implementation and the Chromium's rendering engine.

25:19 And you can basically run Python, runs JavaScript and Python all together with Python.

25:26 And it's kind of hard to explain without looking at it.

25:29 But it's sort of a thing that's just starting out.

25:32 And it's not an open source thing.

25:34 It's a group doing this.

25:36 They're going to do it for money.

25:37 But it's not expensive.

25:39 It's free for individuals and including commercial use for individuals.

25:43 And there's a bunch of tutorial videos.

25:45 Now, I'm watching some of the tutorial videos.

25:48 One of them is like implementing a calculator.

25:51 And one of them is like implementing a spinning cubicle.

25:54 Or a cubicle.

25:55 No, a spinning cube.

25:56 But a spinning cubicle, that'd be cool.

25:58 Somebody should do that.

25:59 Now, they clearly know what they're doing when they're writing this.

26:02 And it might be that I'm just not a JavaScript person because the code they're writing doesn't seem obvious to me.

26:08 But it isn't that much.

26:10 So a handful of code.

26:11 A handful of little bits of code and stuff.

26:14 And you can implement something like a calculator on your web browser if you want.

26:18 It's pretty interesting.

26:19 So, yeah, there's a visual calculator.

26:21 I see that.

26:22 And it looks like a desktop app.

26:24 But obviously, we know.

26:25 It's basically the Python equivalent of Electron, right?

26:28 Like HTML and JavaScript and Node.

26:31 Yeah.

26:31 What kind of surprises me here is at least the calculator example is integrated with Vue.js, which is kind of actually super cool.

26:42 So you define a Python class.

26:46 In the Dunder init, it sets up the Vue class.

26:50 And if you've ever done Vue, that looks really familiar.

26:52 You would say, here's the element that is the root of the app.

26:56 Here's some of the bound data.

26:58 Here are some of the methods.

26:59 And then you just point, you basically just set the function to the various Python functions.

27:04 Like they clicked on a number.

27:05 They clicked in an operator.

27:06 I like it.

27:08 This is actually pretty cool.

27:09 Yeah.

27:09 I think it looks neat.

27:10 And it sounds like what they're doing is they're having some way to automatically convert existing JavaScript libraries to Python modules.

27:19 Yeah.

27:19 So you can call them from your Python or hook up to them or something.

27:23 I mean, it's available.

27:24 It looks like it has development kits available right now for Python 3.6 and 3.7.

27:29 And anyway, for somebody wanting to play with GUIs for Python, I think this is something to pay attention to.

27:35 I wish them luck.

27:36 I'm not a zealot for open source only.

27:39 I make money on this by going to work.

27:42 So these people can too as well.

27:44 And I'm over here looking at the pricing.

27:46 Free for individuals for commercial use.

27:48 Academic, it's free.

27:50 Company enterprise.

27:50 Developer license.

27:51 $599 per developer per four years.

27:57 Honestly, they should put another zero on that.

28:00 And I think it would still be okay.

28:03 Because that's totally reasonable.

28:05 It's not like they're saying it's $1,000 per year per developer.

28:08 It's not much.

28:10 So I'm happy to talk about it.

28:11 It looks great to me.

28:12 Yeah.

28:12 It looks neat.

28:13 For sure.

28:13 Well, what do you got on the extras for us, Brian?

28:15 Anything else you want to throw out there?

28:17 Yeah, I want to bring up a couple of things.

28:19 I wanted to thank you for the excellent search feature that we have on Python Bytes.

28:24 You're welcome.

28:25 Because every week, believe it or not, I got to come up with like three items to talk about.

28:30 And sometimes we've already covered it.

28:32 And that was the case this time.

28:34 I ran across another reference to a tool called Cerberus, which is a JSON schema validation tool.

28:42 Yeah, that's a cool one.

28:43 Yeah, I love it.

28:44 It comes from Nikola.

28:45 He built that as part of the EVE framework.

28:47 Okay, well, it's really pretty neat.

28:49 And it has a lot of extensibility features that I haven't seen in other validation tools.

28:54 But we covered it in episode 70.

28:56 And I found that out through your search feature.

28:58 The other thing I wanted to bring up was this funny thing happened.

29:02 I put some, the other day I put used data classes in some test files, test modules,

29:09 because we've converted to Python 3.7 at least.

29:12 I'm using, we're slowly converting to Python 3.8.

29:15 But a colleague of mine looked at my code and said, oh, these data class things look cool.

29:20 How did you learn about them?

29:21 I'm like, well, kind of my job.

29:24 It's awesome.

29:26 I didn't say, well, you should listen to Python Bytes, because it seems weird to encourage my coworkers to listen to it.

29:31 Send them my way.

29:32 I'll tell them to listen to them.

29:33 Okay.

29:33 Learn about my coworkers.

29:34 I can tell them.

29:34 How about you?

29:36 Got anything extra for us?

29:38 Just something super quick.

29:39 I ran across this article.

29:40 It's not directly related to Python.

29:43 So I didn't make a sort of main item.

29:45 But there's this project from Google where they've been working on the upstream Linux kernel

29:51 using what they have called sanitizers.

29:55 And basically these are like C-Linter type things that go and find problems with the code.

30:01 So they had an address sanitizer for finding memory corruption and undefined behavior for certain code and other issues.

30:08 And then they've come up with this one called the KCSAN.

30:12 I don't know.

30:13 The kernel concurrency sanitizer.

30:16 And they then turned it on the latest Linux kernel.

30:20 And what they found is in a two-day period, they found over 300 unique race conditions and deadlocks and stuff within the mainline kernel of Linux.

30:28 Wow.

30:29 Anyway, there's some comments and stuff about this and links back to what they're doing.

30:33 And it's kind of interesting.

30:34 The code's on GitHub.

30:35 Are they fixing them or just, you know, pointing out problems?

30:38 Well, to point out a problem, like a concurrency problem like that is one thing.

30:42 But to fix it, I think, is a whole entirely another without, you know, causing two more deadlocks somewhere else.

30:48 So I don't know.

30:49 Maybe they're just making people nervous.

30:51 So making people nervous, maybe this joke might, a little bit, probably not.

30:55 But after the one last week, I don't know, man.

30:58 We're pushing the boundaries.

30:59 So let me ask you a question.

31:01 When you talk about a link on the internet and it's, you know, HTTP this or that, you call it a URL or an URL?

31:08 Well, I call it a URL.

31:09 Yeah.

31:09 Some people call it URLs.

31:11 What's the URL for that?

31:12 Some people say URL.

31:13 Anyway, whatever.

31:14 So there's this joke that comes from Aiden Berry.

31:18 Brian, what's a web developer's favorite T?

31:21 Well, it'd be Earl Gray or URL Gray.

31:25 Of course it would.

31:27 Of course it would.

31:27 Awesome.

31:28 I love that joke.

31:29 I laughed way too hard when I read that joke the first time.

31:32 Yeah, me too.

31:33 Me too.

31:34 It's written.

31:34 It's even better.

31:35 So check it out in the show notes.

31:36 All right.

31:36 Aiden, thank you for sending that in.

31:38 That's great.

31:39 Thank you.

31:39 Yep.

31:40 Thanks, Brian.

31:40 Catch you later.

31:41 See you.

31:41 Bye.

31:41 Thank you for listening to Python Bytes.

31:43 Follow the show on Twitter at Python Bytes.

31:46 That's Python Bytes as in B-Y-T-E-S.

31:49 And get the full show notes at Python Bytes.fm.

31:52 If you have a news item you want featured, just visit Python Bytes.fm and send it our way.

31:57 We're always on the lookout for sharing something cool.

31:59 This is Brian Okken.

32:00 And on behalf of myself and Michael Kennedy, thank you for listening and sharing this podcast

32:04 with your friends and colleagues.

Back to show page