Transcript #231: Go Python, Go!
Return to episode page view on github00:00 Hello and welcome to Python Bytes. This is episode 231, recorded April 28th. Is that right? Yeah. 2021. I'm Brian Okken.
00:09 I'm Michael Kennedy.
00:10 I'm Cecil Phillip.
00:11 Yay.
00:12 Hey, welcome Cecil.
00:13 Hey, thanks for having me on. It's always good to come back on this podcast. This, you know, unbiasedly is probably one of my favorite podcasts to listen to, to be honest with you.
00:21 Mine too. Yeah.
00:23 Thanks so much.
00:25 We get to learn so much stuff by studying and just getting ready for each week. And it's always fun to just see like the new and exciting. Like developers, we love the shiny new things, right?
00:34 Yeah.
00:35 Absolutely. Well, before we jump into the topic, I thought maybe we could let Cecil introduce himself real quick. I know you've been on the show before, but it's been a little while.
00:43 Yeah, it has been a little while since I've been on. But hi, everyone. I'm Cecil Phillip. I'm a cloud advocate at Microsoft.
00:50 And that pretty much just means I spent a lot of time in the community working with, you know, different companies and students and, you know, just really creating content around how, you know, how developers can start using our tools.
01:02 One of the things that I do, Michael's showing you, you know, one of the pages from our Channel 9 video site. I help run the on.net show.
01:11 It's not Python, but it is .NET and we do talk about, you know, just a lot of different things in the ecosystem.
01:17 So about-
01:19 You also do Python stuff on some live stream on Twitch and so on, right? Just not on the official .NET channel?
01:24 Yeah, yeah, yeah. So we do do, the live streaming stuff happens on Twitch and YouTube. And, you know, you could always go back and check out like the, you know, the recordings of those tools.
01:33 Really quickly, before we jump to Brian's item, I do want to point out on the screen that's top level statements that C# has added, which is like, let's be more like Python.
01:43 I just think that's kind of an interesting thing, right?
01:45 I think with the last set of, like in C# 9, a lot of the things that came out of the last language feature set, everyone is just like, this looks a lot like Python.
01:54 This looks a lot like Python.
01:55 Wait till .NET 6 and C# 10 come out, then I'll have to see what you say there.
02:02 We're going to use the def keyword and all that. Typing's optional.
02:06 Got it.
02:07 I mean, I don't know. We'll see. We'll see what happens.
02:09 So I might have to check out C# again if it gets close to Python.
02:13 I mean, it's not a bad sign to jump in.
02:15 Yeah. Yeah. Definitely one of the better languages out there. I certainly think so.
02:19 All right, Brian, take us away. What's your first item here?
02:21 Are you going to tell us or else what?
02:23 Yeah. Or else.
02:25 So I actually was intrigued by this because this is, it's an article called the basic, well, what's the article called?
02:33 For else, a weird but useful feature in Python.
02:37 Plus there's a cute avocado stuffy.
02:41 But there's, I'm not used to using else or break in my Python code.
02:47 I just don't do it that much.
02:49 So the, yes, hello birds.
02:52 So the, this is an interesting, interesting article about, about the else block.
03:03 And what it does is if you've got a for loop and you, there's no break inside of it,
03:10 well, then your else will get hit.
03:11 So the only way to use a else effectively is to maybe have a break so that you,
03:17 at some times don't hit it.
03:20 So it's still a little confusing to me.
03:23 So I was reading more.
03:25 The, the article goes on about talking about some examples where you'd want to do it.
03:30 And, and it does explain, it explains it way better than I just did.
03:34 So if you're interested about that, read the article.
03:36 But the, the, the explanation of why you would use it.
03:40 My favorite is if you were going to iterate to find an item.
03:44 And you would normally maybe use a found flag or something to say that you found it.
03:51 You don't need to with this.
03:52 You can, you can, once you find the item, you can break.
03:57 And then the, and then you'll hop out and the else block will only get run if you did not find the item.
04:05 So that's really pretty much the use case that I think is neat.
04:09 Yeah, I agree with that one.
04:11 And I, I love the break out of these loops early, you know, because we end up so often with super indented code, right?
04:19 It's like, if this is true and if this is true and if this is true, and you could put those into a couple of breaks or continues in your loop.
04:26 And then, oh boy, it's nice and flat ish.
04:28 Yeah.
04:29 The, the other, one of the other use cases he brought up was, was using it with an exception.
04:35 So if, if you've got an exception, try except block within a for loop.
04:41 And, and you kind of want to know outside whether or not any exceptions were caught.
04:47 You can use the else block to find out if you, if any of the exceptions.
04:50 Man, I can't get behind that.
04:52 Like, I know that's the use case.
04:53 Try this else.
04:55 I can't get behind it.
04:56 I, it's just, it's too, it's too weird for me to think about.
05:00 I, I would, I just never use it because it just seems a little unusual.
05:05 And I, I know I've talked with some folks on the internet.
05:07 They're like, oh, but this is a way to add like a continuation to your try block that you
05:13 won't overcatch errors.
05:14 And I'm, yeah, I don't know.
05:16 I hear you.
05:17 But I, but this, this else one on the loop, I could, I can see this as a, you know,
05:21 not too bad compared to found flag.
05:23 And then what I want to express before we leave this is if you're going to either put
05:28 a, I think both break or else, if that's in your code, there should be a comment explaining
05:33 what it does because there's a lot of Python developers that won't know what's going on.
05:37 So.
05:38 Yeah.
05:38 So what do you think?
05:39 Yeah.
05:40 I, I actually really like both of them, like both the four, the four else and the, the
05:45 try else only because I think about how much code would I have had to have written otherwise.
05:51 You know what I mean?
05:52 Yeah.
05:52 For me, it just kind of makes those situations a little bit more succinct.
05:55 And I completely understand what you're saying because a part of me also on the other half
06:00 is like, well, I could just put the rest of the code inside the try block.
06:03 Right.
06:04 And then, you know, obviously there's no exception.
06:06 We'll just keep running on.
06:08 Exactly.
06:08 Yeah.
06:09 Like my continuation happens in the same block of code.
06:11 So I completely understand it from that perspective too.
06:14 So I don't know.
06:15 I guess I'm kind of 50, 50 on it.
06:16 I kind of like it.
06:17 I kind of, I'm like, well, we could do it another way.
06:20 So I don't know.
06:21 Yeah.
06:21 And just jumping back a tiny bit.
06:24 That's all.
06:24 Dean has a bit of foreshadowing for you in the live stream.
06:27 John posted in 2022, looking for Pi Sharp developers with 10 years of experience.
06:31 Wow.
06:32 And Rob is out there giving a shout out to Brian's birds.
06:38 I don't know how accurate that emoji is, but it looks pretty legit.
06:41 That's pretty good.
06:42 Yeah.
06:42 We got, I got three here.
06:43 Nice.
06:45 All right.
06:45 I think I got the next one, right?
06:47 So let's talk.
06:48 You were done with this one, right?
06:49 And I didn't steal it from you.
06:50 Yeah.
06:51 And I'm going to, I'm going to step out and cover the birds.
06:53 So.
06:54 Okay.
06:54 Well, I'll tell you about the ORM while we're doing that.
06:57 So probably the two most popular ORMs we have out there are Django ORM.
07:03 And if you're, which really only makes sense if you're actually doing Django or SQLAlchemy.
07:08 And those are both really interesting, but I want to give a shout out to Tortoise ORM.
07:12 I think these names are always interesting.
07:14 Like naming things is hard.
07:15 I always think of databases and database libraries to be awesome if they're fast.
07:20 Yeah.
07:21 The less awesome if they're slow.
07:23 But Tortoise doesn't scream speedy.
07:25 But I think you should think of it more in the speedy side because it's primarily an asyncio object relational mapper inspired by Django.
07:34 So if you were like, I love what Django does, but what I really want is an async version of that.
07:40 Tortoise ORM is a really good example.
07:42 And, you know, it uses the active record design pattern instead of unit of work, which SQLAlchemy uses.
07:48 So it's pretty neat.
07:49 They have a bunch of performance stuff.
07:51 And I really like that they show performance against many different ORMs, not just Django and SQLAlchemy, but other ones like Pony and Kiwi and a lot of different use cases.
08:00 You can get a sense.
08:00 Like it's pretty fast.
08:01 It's not raging fast, but it's async.
08:03 So that's a really, really good option there.
08:07 Super simple to use.
08:09 When you install it, you typically need to install the underlying database driver that it's going to use.
08:14 So if you're going to use it with Postgres, you install asyncpg.
08:17 If you're going to use it with MySQL, you install AIO, MySQL, and so on along with it.
08:22 But if you look at the code, it's super simple.
08:24 And if you're familiar with Django, you go and create the fields as members of a class equal to some descriptor like fields.intfield or field.textfield.
08:34 Set them have indexes and so on.
08:38 What's really nice is there's like really good modeling of relationships.
08:41 So there's like fields.foreignkeyfield, fields.mini2misfield, and it talks about the relations and so on.
08:49 So yeah, this is a really nice RM.
08:51 If you're looking for something async that is like Django, give this a shot.
08:54 It's pretty popular.
08:55 It has almost 2,000 GitHub stars.
08:57 It was updated two days ago.
08:59 So yeah, it seems like a nice, happy project.
09:02 This looks pretty cool.
09:03 When you were showing that installation section just now, so you still have to install like the async versions of, I guess, that particular database's driver.
09:12 So async MySQL, async Postgres, and things of that nature.
09:15 So I'm guessing what this adds, kind of like what you said, is that active record programming model.
09:20 So if you want to write your code in that style, you know what I mean?
09:23 I can write it and then now I could just switch, swap out the database driver and I could point to a different database implementation if I wanted to.
09:31 Yeah, exactly.
09:31 I think it does two things.
09:33 One is there's always like database dialects, like how do you express parameters?
09:37 Question mark or at parameter name or whatever, right?
09:40 I think it handles that.
09:41 And then a lot of those drivers, they're async, but they only work in raw SQL.
09:46 So select star from such and such and so on.
09:49 And so this just gives you the ORM wrapper on top of it.
09:52 But I think it does this dependency thing because otherwise it would have to install like every driver it supports.
09:59 Sure.
10:00 And, you know, that would be a hassle, right?
10:02 Because you only want one.
10:03 Yeah, that would be a little messy.
10:04 Yeah.
10:04 Why does it take so long to install?
10:06 Well, it's installing every database driver it can think of.
10:08 No, this is pretty cool.
10:09 I like it.
10:09 Brian, what do you think?
10:10 Actually, I think it's pretty great.
10:12 And I was actually starting to look at an ORM for a new project.
10:17 So I might check this out.
10:18 Yeah, I like it pretty well.
10:20 It's got some really simple ways to program it.
10:22 You can create one of these objects and then you just await tournament.save.
10:27 If it's a tournament in this case, or it has like a factory sort of create method for queries.
10:32 You go do some kind of query, then just await a class.filter type of thing.
10:37 And it even does like the join.
10:39 So you don't end up with the N plus one performance problems.
10:41 One thing I guess I would throw out there is it seems to me like this is 100% async.
10:46 So if you're going to use it, you have to create an event loop and just run it in there.
10:51 And if your app is not very asyncy, then it might be kind of a hassle to use.
10:55 I'm not totally sure about that.
10:56 It used to be that there were these wrappers you could get that would take non-async libraries and database libraries and stuff and make them async by putting them on threads.
11:04 I can see a world where we get back to wrappers that make them sync so they're easier to use if you don't want to do async.
11:09 Yeah.
11:09 I know one of the things for me that's always been a little challenging is when you have like these async database things, like how do I test them?
11:17 You know what I mean?
11:18 I always find like testing, at least when it comes to unit testing, testing asyncio things is relatively non-trivial.
11:27 You know what I mean?
11:27 Yeah.
11:28 Like I have a thing that uses motor, like so the MongoDB async library, and I'm using it in FastAPI.
11:35 And, you know, FastAPI does this injection thing.
11:37 I'm like, oh, great.
11:38 My code is clean because I'm, you know, I'm separating concerns and I'm doing all this thing.
11:42 Man, like how do I test this thing?
11:44 Like how do I...
11:45 Brian, do you got any advice on testing async things?
11:48 Well, I don't right now, but I think that'd be a great topic to explore and try to get some people on the podcast.
11:54 Yeah.
11:55 Yeah, I agree.
11:56 Yeah, that'd be great.
11:57 If you ever write like part two of your book, I'd love to see it.
11:59 Well, there's a second edition coming out, but it doesn't include async.
12:05 It hasn't published yet, has it?
12:07 There's still time for another chapter.
12:08 There you go.
12:09 There you go.
12:10 Jumping back, I did see that Brett Cannon had an interesting...
12:18 comment about the else clause.
12:20 One of the benefits is that...
12:23 Hey, Brett.
12:23 Makes you look like a Python expert in code reviews when you suggest people use it.
12:27 So...
12:28 I think that's funny.
12:31 Yeah, that is funny.
12:32 Yeah, a lot of thoughts here on the else clause.
12:35 I do think it's one of these things.
12:36 It's a little unusual.
12:37 Like a lot of languages have like, oh, we all have the while loop.
12:40 We all have the for loop.
12:41 We all have the statements.
12:42 They all look like this.
12:43 And this is kind of a little bit different.
12:44 So it's kind of interesting.
12:45 All right.
12:46 Cool.
12:46 Cecil, you're up next, right?
12:48 Yeah, I am.
12:49 So I ran into this post about faster Python with Go shared objects, which I thought was
12:54 a really interesting read.
12:56 Mainly for me, I'm really into like language interrupt, right?
13:00 Like the fast part is cool and I get it.
13:02 Like fast is always a relative thing that we could consider.
13:05 What do we really consider to be fast or not?
13:07 But, you know, it's always interesting for me to see how we can take one language and
13:11 another and kind of plug them together.
13:12 You know what I mean?
13:13 Because I'm a big believer in let's, you know, let the thing do what it's best at.
13:18 You know what I mean?
13:19 Like, so for instance, Python is really good at doing certain things.
13:22 Let Python do that.
13:23 Or Go is really good at doing certain things.
13:25 Let Go do that.
13:26 But now how do we plug these worlds together?
13:28 And so this article kind of goes through talking about how, you know, within Go, you can create
13:33 these things called shared libraries.
13:35 And I believe what it does is that it outputs a .so file or a .dl file.
13:40 Yeah.
13:41 And then based on that in Python, you could use something like ctypes or this article actually
13:46 even references something called cffi.
13:48 I've never heard about cffi.
13:50 I don't know if y'all have spoken about it before.
13:52 Yeah, it's a more modern interop layer between c libraries.
13:56 Yeah, I think they mentioned it as well.
13:58 Yeah, yeah, right there.
13:59 Yeah.
13:59 So it mentions using things like cffi, for instance, to be able to load some of these
14:04 files and do interop, which I think is actually pretty cool.
14:06 You know, it does also talk about some of the pros and cons, which I think are very important
14:11 to discuss.
14:11 So for instance, this says, well, it's really good if you're just passing around like primitive
14:16 types.
14:17 But now when you want to pass around like more complex types, like, you know, dictionaries
14:21 and classes and things of that nature, then it becomes a little bit more tricky to do.
14:25 But, you know, again, just in terms of, hey, I have this thing.
14:28 I want to pass on to go to maybe, I don't know, maybe go runs it in the background or,
14:33 you know, runs this microservice thing that, you know, does Docker and Kubernetes or whatever
14:38 the case is.
14:39 You know, we could leverage both ecosystems to, again, have them do what they're good at
14:43 and kind of like just plug them together, which I think is a pretty cool read.
14:47 I'd love to hear what folks think about it after they read through it.
14:50 Yeah, I think it looks really interesting.
14:51 You know, one of the powers of Python is this interoperability, mostly around C, but also
14:56 other things like weird things like Fortran and so on, right?
14:59 Like people say, oh, well, doing math with Python is super slow relative to C++ or whatever.
15:05 And yet data science is so popular where it's almost all math, right?
15:08 How do you square these two things?
15:11 Like, how do you make them work?
15:12 And it's because a lot of that gets pushed down into some more native layer, like a C layer.
15:17 You just hand off the data and then zip it.
15:20 The real work happens there.
15:21 And this seems like another really cool way to do that, right?
15:25 Something that works really well in Go, write a package, wrap up the Go bits, put them in a wheel,
15:30 hip install them, and people don't have to know.
15:33 It's also not just what the language can do best.
15:36 It's what the developers can do best.
15:37 And if you've got somebody that's really good at Go working on part of the problem,
15:42 being able to connect them together is a good idea.
15:45 I think that we're far away from the time where people just had one language that they knew anyway.
15:53 And I don't know if we ever were there.
15:57 But definitely, you know, early in my career, there were some C and C++ developers that that's all they knew.
16:03 A little shell scripting.
16:05 But I don't find that anymore.
16:07 And I think most Python developers know some other language as well.
16:10 Yeah, like CSS.
16:12 They typically program in CSS.
16:13 That's just the bad.
16:15 That's what the bad surveys ask.
16:16 No, but you're right.
16:17 And it's also not just about knowing the language.
16:20 It's about, well, we spent two years building this other library and it works.
16:24 Can we just use that over here?
16:26 Like this interop for just reuse is really powerful as well.
16:29 Yeah, definitely.
16:30 Yeah.
16:31 I always found when I was growing up, you know, when I went through college, you know,
16:35 my professors always told me any good programming, good programmer knows like three or four different languages.
16:41 Like that's, you know, what they kept drilling into us.
16:43 And it's funny, we always talked about learning different languages, but we never ever spoke about putting them together.
16:48 You know what I mean?
16:49 And kind of like what you were saying, right?
16:51 I feel like that's kind of where we are.
16:52 Like no one knows one language.
16:54 You know, like no one that works in a company in a really productive ecosystem does one thing.
17:00 You probably know some JavaScript and some Python and some, you know, Go and Rust and SQL and like there's stuff in there.
17:06 But how do we put that stuff together in a very clean and like maintainable way?
17:12 Yeah.
17:12 Another thing, you know, thinking back to the times when we were all in college, so much of what we did was like really low level.
17:19 Like, oh, I need to, you know, load this file.
17:21 So I got to write the binary bits to parse this file, right?
17:25 It was like super low level and it took a long time.
17:27 And these days it's more about Lego blocks.
17:29 Get this thing, that thing, click them together and make that piece go over there, right?
17:32 And this whole interop for that is also, you know, makes sense in that world.
17:36 Yeah.
17:36 Well, we have some, you have some cool, I want to plug your stuff.
17:44 So we don't have a sponsor.
17:45 So we'll plug your training.
17:47 Yeah.
17:47 So, yeah.
17:47 Thanks, man.
17:48 I appreciate it.
17:49 Yeah.
17:49 Well, you, let me, I'll be specific about something.
17:52 Something that I think if you dug through the course catalog, there's a little coming soon graphic, but people probably don't know is we're about to release a course on Dask.
18:00 So Dask is a way to do like pandas type stuff.
18:03 But if it needs to load 10 terabytes of data and that won't fit even on your hard drive, or you want to run it across, you know, 16 cores on your machine across 10 machines, you just write pandas code, but you point it somewhere else.
18:16 And it just parallelizes that beautifully with this cool little dashboard.
18:19 So anyway, there's a free course coming on Dask that people will be able to take really, really soon.
18:23 That'll be fun.
18:24 No, it's good.
18:25 I think everybody should check out your course catalog.
18:27 And one of the best things that happened to the Python community was when you quit your full time job and started working on this full time.
18:33 Thanks.
18:34 A short four or five years ago.
18:36 I would definitely concur with that.
18:40 I'm curious about Dask too, because I remember you all speaking about it in a previous podcast.
18:47 And I always wondered, oh, wow, is this only for pandas?
18:50 Or can I use Dask to just run remote Python anywhere I wanted to?
18:54 I think you can actually, I do think you can make it run remote Python.
18:59 The simple use case is sort of import something different that looks like pandas and use it, you know?
19:04 But I think there's a way, there's like a lower level set of libraries that do that orchestration.
19:09 You probably could use it.
19:11 I'm trying to remember and make sure that that's the right one.
19:12 I think that's what Matthew Rockland pointed out when we were talking about it.
19:16 So, yeah, quite cool.
19:17 Yeah, because that would make, for me, makes Python really interesting from a distributed systems perspective.
19:22 Yeah.
19:23 Again, we think about like containers and multiple VMs and even just talking across boundaries of networks, right?
19:29 Yeah.
19:30 Yeah, and just being able to import my library and run it.
19:33 You know what I mean?
19:34 Yeah, absolutely.
19:35 Super cool.
19:36 All right, Brian, you got the next one?
19:37 Yeah.
19:37 So, speaking of learning to code, you know, as you go on with your learning to code, there's tutorials and stuff.
19:45 But then you want to get into really finding out how things, people are really solving problems all over the place.
19:51 And a great discussion around that is to, and good recommendations, is to just go read some code.
19:57 You need to read a lot of code.
19:59 And there's problems with that, though.
20:01 And so, this is an interesting article I'm going to link to.
20:04 Learning to read code, Python Standard Library Design Decisions Explained for Advanced Beginners.
20:11 That's an interesting term, advanced beginners.
20:13 But, so, there's an interesting discussion around this.
20:17 So, the standard library is there.
20:18 So, that's a great thing to go look at.
20:20 It's available.
20:21 And all of it's there, so you can read all of it.
20:25 But there's some interesting caveats and some in both good and bad.
20:30 So, there's pros and cons.
20:31 One of the pros is all the peps are around.
20:33 So, you can read the design decisions of why things are the way they are.
20:38 And some of the history and what problem they're trying to solve.
20:41 That's actually an incredible benefit because I don't even get that with, like, internal code often with a company.
20:49 It's often just the code that was left to me that I have to maintain.
20:52 So, this is kind of neat.
20:54 And usually, it was done just enough to work and then we're done with it.
20:57 Yeah.
20:59 So, and Python gets to improve on itself, which is nice.
21:03 The downside is there's a lot of it and a lot of it's really old.
21:08 So, there's some code in there from 10 to 20 years ago.
21:11 And there's what's Pythonic now might not have been Pythonic then.
21:16 So, maybe not best practices.
21:18 I don't know this firsthand, but this is a comment from the article.
21:22 So, I think that's fair.
21:23 And also, you don't really want to learn.
21:26 This isn't necessarily from the Python Center Library, but just picking something that you use on GitHub.
21:35 It could be incredibly useful.
21:37 That doesn't mean that it's coded well, though.
21:39 So, it might not be a good example for coding.
21:41 So, the author has three or four different standard libraries that it recommends, which is pretty interesting.
21:50 The statistics module.
21:52 It says the code is simple and it's fairly well documented.
21:57 And the PEP describes...
21:58 I think it's also pretty new, which is kind of a...
22:01 Oh, really?
22:01 Good.
22:02 I'm not sure when the statistics...
22:04 But it was added.
22:04 It didn't come originally.
22:06 It's been added after a while.
22:07 But there's other things around that people use statistics for statistics.
22:12 So, the PEP apparently talks about design decisions about not trying to reimplement NumPy or something like that within the standard library.
22:21 But just have basic statistics.
22:23 3.4, by the way, is when statistics showed up.
22:27 Oh, yeah.
22:27 So, it's not that old, right?
22:29 Yeah.
22:29 And actually, the next two are fairly recent as well.
22:33 Pathlib is recommended because it's extremely well documented.
22:38 And it's...
22:40 Oh, no.
22:41 And object-oriented, good object-oriented example.
22:44 There's not a lot of object-oriented examples out there in Python because a lot of people don't use it.
22:48 So, it's good.
22:49 Also, a nice comparative study because we already had OSPath.
22:53 So, you can look at how OSPath solved it versus Pathlib solving the same problem.
22:58 That's kind of neat.
22:58 Data classes is apparently very well documented.
23:06 And I'm not sure what else I was going to say because I wrote down, it's a good example of data classes.
23:10 That doesn't make sense.
23:12 It may be the very best example of data classes implementation.
23:16 Yeah.
23:17 Or the only.
23:19 And then Graphlib, which says it's a bonus, but it's interesting because it does one thing.
23:26 It's an implementation of a topological sort algorithm, which I'm not exactly 100% sure what that is.
23:33 But it's a narrow problem.
23:35 And there's no PEP, but apparently there's an issue that the article links to with a long thread discretion.
23:42 And the interesting thing about this isn't the discussion about how it should be implemented.
23:47 It's the discussion of what the API should look like.
23:51 So, how it should be used from a user perspective.
23:55 And that actually seems fascinating to me because I think we need to talk about that more of people.
24:00 How designing APIs and coming to terms with that is almost more important than what the code looks like.
24:09 Because you have to live with the API.
24:12 You can change the code later if you need to.
24:14 Yeah.
24:15 That's a good point because you can refactor internally.
24:17 But yeah, the API you're stuck with.
24:19 Unless you're like one of the packages I use for security on the website today.
24:23 That just completely changed a bunch of the module names and submodules and moved classes around.
24:27 And then my website in dev, not in production, wouldn't start after I updated it.
24:33 I'm like, well, I don't understand.
24:35 Shouldn't there be at least a deprecation warning for a little bit or something?
24:38 Nope.
24:38 Oh, well.
24:39 One of the things I really like about articles like this.
24:43 Oh, I'm sorry.
24:44 Yeah, I was going to say.
24:45 One of the things I really like about articles like this is, you know, we often talk about like the beginner path.
24:51 Like how do I get started with a thing?
24:53 But after we've, you know, you know, brought all these beginners together, like how do I take you from beginner plus plus?
24:59 Like what is like the next step look like?
25:00 And, you know, you always hear folks talk about just you got to read code, right?
25:05 Like go to GitHub and click browse and kind of just dig around projects that you're interested in and things you want to learn about and kind of just try and understand how it works.
25:13 Right.
25:13 Like if you want to understand how Flask works, if you want to see how folks use different things and FastAPI or Django or even Tortoise that Michael was showing a little while ago.
25:21 I mean, just it's open source, right?
25:23 And that's the beauty about it.
25:24 Yeah.
25:24 You just go on GitHub and just read the code and then, you know, change it, right?
25:29 Change it on your machine and see what it does and see, does it get faster?
25:32 Is it slower?
25:33 Is it more or less readable?
25:35 You know, do you understand it a little better?
25:37 Did the test make sense?
25:38 Brian could tell you about like writing good tests for different packages and stuff.
25:42 But I think we need to do more of this.
25:45 Like, and we as like an industry, because I feel like we're like a drowning in how to get started content now on this level.
25:52 You know what I mean?
25:53 Let's go like one step above that now and start to talk about like what is the step two, three, four look like, you know, between junior and senior.
26:03 Yeah, there's definitely that cliff.
26:04 Brian, you got a learning curve here to back this up?
26:06 Yeah.
26:07 No, I just saw this interesting graphic.
26:09 I think you muted, Brian.
26:10 Oh, yeah.
26:12 I saw this interesting graphic and I kind of related to it really well in production.
26:18 I'm not sure about the early parts of the learning curve.
26:22 But the end part is welcome to production programming where there's strange mission critical code left behind by the last developer.
26:32 And I mean, actually, this is, you know, funny, but also it's true.
26:37 In, you know, production code in a company, you often have to support code that you don't know what the decisions are.
26:44 You don't.
26:44 It's just it's working, but you're not sure why it's working.
26:47 And yeah, there's some strange stuff.
26:50 Yeah.
26:51 It can definitely get weird in that stage.
26:53 But Cecil, I agree that going from like, oh, I learned, learned the language so I can actually do stuff that there's a huge gap right there.
27:01 Dean out in the live stream says, I wonder if some design decisions that were best in the 90s are less optimal today.
27:07 I feel like in the 90s it was all about object, object orienting all the things.
27:12 And then there was like a push, like, you know, maybe that's not the best way to just develop everything.
27:17 Like maybe a little bit mix, a little bit of composition and so on.
27:20 That's fun.
27:21 And then John says, coming from a number of other languages, when I first started using Python, I took a conscious effort to seek out learning the idiomatic on way of doing things.
27:30 And I think that's really important because it's so easy to just get it to work and then like leave it there.
27:34 And you're like, no one would ever do this.
27:36 Well, you wouldn't like put your number in a fake for loop that increments that.
27:40 And it goes the other way, too.
27:41 So like Cecil mentioned, real developers, if you work a professional developer is going to know several languages.
27:53 But it's not just knowing three languages and knowing how to code C in three different languages.
28:01 It's about learning the idiomatic way to do Python.
28:05 It's learning how to do C# the way other C# developers do it.
28:10 It's not just about trying to translate your own language into three languages or something.
28:16 And it's even simple stuff like variable naming and function naming, right?
28:20 In Java, you start with a lowercase letter, then have camel case in a Python.
28:24 It's all lowercase.
28:25 C#.
28:26 I mean, it's just like this person clearly is not of this ecosystem.
28:30 Like you can just tell straight away just by weird things like naming that are so easy to change.
28:33 Yeah.
28:34 I think that's one of the things you see a lot when people do like those auto-generated libraries.
28:39 You know, so I know some folks, if you're familiar with things like OpenAPI and Autoress and things of that nature,
28:45 like you point a thing at your API definition, it just generates stuff.
28:50 Right?
28:50 But what if the casing doesn't match, right?
28:53 So if I generate like a Java library and a JavaScript library and a Python library, you know,
28:58 but like the casing is going to be different across all those idiomatically.
29:02 But like now these code generator things have to kind of take that into consideration as they're building out these libraries.
29:08 Your classes like Pydantic that automatically map them over now have to look like Java classes or whatever.
29:13 I did see in Pydantic that you can now have an alias.
29:16 So it's like this is what it looks like in JavaScript, but it has this other proper name, like this Python name in Python,
29:22 which is I think it's kind of cool.
29:23 All right.
29:24 Let's talk about something that's really fun and visual.
29:28 So there's this thing called Bradio, Gradio, something.
29:32 I'm messing up the pronunciation.
29:34 I'm sure this comes to us from David Smith.
29:36 So thanks for sending that over.
29:38 And this is a really cool way to add simple interactive UIs to your machine learning scripts.
29:45 So it says generate an easy to use UI for your ML model function or API with only a few lines of code
29:51 and integrate it directly into your Python notebook or share a link with anyone.
29:55 So here, like all beautiful user interface things, it actually has not just graphics, but interactive graphics.
30:02 So you might import Gradio and then write the code that implements it and then just give it the function that it wants to use and say the input is a sketchpad
30:12 and the output is a label run and that's the implementation.
30:15 So here's a machine learning model that allows me to draw an ink and then tell me what letter it is.
30:22 So if I did like this, it'll tell you, oh, I think that's a seven.
30:25 That's not a seven.
30:26 Let's see.
30:26 What about a one?
30:28 You think that's, I think that's a four.
30:29 This model is not very good, but that's not the problem.
30:33 That's not the point, right?
30:34 That should be a five.
30:35 I'm going to draw, I'm going to do a zero.
30:38 There we go.
30:39 Yes.
30:39 I nailed it with a zero.
30:40 Two.
30:42 Yeah, two and those two.
30:43 I don't know.
30:43 The point is not that the model is accurate, but this is a really cool UI that you can build
30:48 in a couple of lines of code, right?
30:50 I think that's super.
30:50 Yeah, this is pretty nice.
30:52 Yeah.
30:52 Let's see what other examples they got in here.
30:54 Question and answer with a paragraph.
30:56 So here's the text that the source text is, you know, Victoria has written a constitution
31:02 enacted in 1975, et cetera, et cetera.
31:04 And then you could ask the model the question, when did Victoria enact its constitution?
31:09 Holy moly.
31:09 Wait for it.
31:10 1975.
31:11 Like that is insane.
31:13 Right?
31:14 And you could cool this.
31:15 You can build this cool UI here, a face segmentation.
31:18 I'm not going to do my webcam.
31:20 It's going to break stuff for the live stream.
31:22 Yeah, all sorts of things though, like little sliders and whatnot.
31:26 We need social distancing.
31:28 Yes.
31:28 There we go.
31:29 So pretty neat way to really simply add UIs and integrate them both onto websites and into
31:35 Jupyter notebooks.
31:35 Nice.
31:36 I like it.
31:37 I like it.
31:37 Yeah.
31:38 I love too that it's just running in the browser too.
31:41 I know.
31:41 That's awesome.
31:42 Yeah.
31:43 I mean, that's proper JavaScript work to be putting like a little sketch pad and then
31:47 taking that image and sending it back up.
31:49 Dean helping us with the naming.
31:51 So ML models usually use gradients.
31:54 So called grade in slang terms, I guess grade IO.
31:58 Yeah, that sounds good.
31:59 Cool.
31:59 Thanks.
32:00 All right.
32:00 So you can take us out of here with the last one you got.
32:02 Yeah, sure.
32:04 Let's take a look.
32:05 All right.
32:07 So my screen should be up now.
32:08 So there's this movie that's coming out later this summer, 2021 called Space Jam.
32:14 I don't know if you ever heard about Space Jam, but heard about it.
32:18 I don't know enough.
32:19 What's that?
32:20 I only heard of it.
32:22 I haven't seen it.
32:22 Yeah.
32:23 I mean, you know, I know if anyone that's born after like the year 2000 probably has never
32:28 heard of Space Jam.
32:29 But what we actually did, so Microsoft and some folks at Warner Brothers, I believe, partnered
32:35 together to create like a set of learning modules and stuff like that around basketball.
32:40 And it was completely inspired by Space Jam.
32:42 So what you're looking at here is a learning path.
32:45 And this learning path, I think, has one, two, three.
32:49 It has about three different modules in here.
32:52 And it kind of walks you through exploring basketball data.
32:55 And you can use that to start like predicting the outcomes of games and player performance and
33:00 all this cool stuff.
33:01 But it uses Python.
33:02 It uses Pandas.
33:03 It uses VS Code.
33:04 There is some JavaScript in there.
33:07 And there's some like real, you know, there's some NBA data in there.
33:10 There's some basketball data in there.
33:11 You kind of use and explore and play around with.
33:14 So I think this is really cool.
33:15 Again, going back to the conversation we had before about like, you know, okay, I know some
33:20 Python, right?
33:20 Like, how do I do some cool stuff with it?
33:22 Right?
33:23 Like, what's the next step?
33:24 And I thought this was a great example of us showing, hey, let me take something that I
33:28 actually care about.
33:29 Maybe some of you all care about basketball.
33:30 Maybe some of you don't.
33:31 But, you know, whether it's sports or racing or, you know, maybe you like to listen to podcasts.
33:36 How can I take podcast data and run some machine learning and, you know, different things
33:40 around it?
33:40 Like, I think these are all really cool projects for you to think about.
33:44 But this one specifically is about like using basketball stats, you know, inspired by Space
33:49 Jam and using Python and Pandas and just, you know, just creating some really cool projects
33:53 out of it.
33:53 So I thought this was cool.
33:54 Hopefully folks check it out and let us know what you think.
33:56 Nice.
33:57 So this is a free like learning thing that people can go check out, right?
34:01 Yeah, this is this is 100% free.
34:02 Excuse me.
34:03 It's 100% free.
34:05 Free as in like, I don't need your, you know, your address and information and all of that.
34:09 Like you could just go out.
34:10 It's a credit card.
34:11 You cancel anytime.
34:12 It's totally free.
34:13 One thing I would tell you, if you do decide to create an account.
34:16 So I have an account here.
34:18 So you'll notice you'll get points.
34:20 You get XP points.
34:21 So this one is worth 4000 XP.
34:23 So if I get that, you know, hopefully I'll bump up and I'll be at a level.
34:27 You're going to go to level nine if you get if you finish this one.
34:29 Yeah, yeah, yeah.
34:30 So I want to I want to make sure I get it make some time to go through this learning
34:33 this learning path.
34:35 But if you do want to sign up, you know, it's a good way to keep score.
34:39 You get badges and all kinds of stuff.
34:41 We do have other Python related courses in here, too.
34:44 Like we just released a intro to Django on here.
34:48 That's in here as well.
34:49 So if folks are interested in that and, you know, did you guys do something with Dr.
34:52 Becky around like NASA or something?
34:55 Or is that?
34:56 Yeah, yeah, yeah.
34:57 We did have we do have one that's around the moon landing.
35:00 And then also, if you remember that that Netflix movie, I think it's called Over the Moon or
35:06 something like that.
35:07 There's also a learn module, I believe, that's also associated with that movie that we partner
35:12 with Netflix on.
35:13 So that was also super cool.
35:14 Yeah.
35:15 Nice.
35:16 What I really like about this is when people are trying to get into program, especially
35:19 taking that next step of like, OK, I've learned what a loop is.
35:22 It's so hard to know what can I build because you have these like, well, I'd love to build
35:28 a game like, well, building a game takes a team of people in a year.
35:31 Like that's not a good next step.
35:32 It's just like knowing what the next thing to build.
35:34 It's a little more complicated that you're really actually interested in.
35:38 You want to build like this is the type of thing, you know, if you had a like a coding
35:42 club at a high school, maybe COVID times is not the best for this, but you could say,
35:46 let's build an app that will do like statistics for our basketball team and like all sorts
35:51 of interesting things like you could build really neat stuff and put it together in ways
35:56 I think people will care about.
35:57 Yeah, exactly.
35:58 And I'm just like I said, just in general, I think the best way for you to go from beginner
36:04 to whatever that next level is, is just find something that you really care about and see
36:08 if you can attach technology to it.
36:11 You know, like I care about basketball.
36:12 I've been watching basketball for years.
36:14 So when I heard Space Jam and Python, I'm like, oh, that's easy.
36:17 You know what I mean?
36:18 Like, yes, like that's something that I care about.
36:20 That's something I want to do.
36:21 Like we mentioned before, we have ones on NASA, but maybe you're into some other stuff.
36:26 Maybe you're into, you know, agriculture and flowers and plants.
36:29 Maybe you want to do something that categorizes that type of stuff.
36:32 Maybe you're into cars.
36:33 Maybe you like racing or, you know, some other activity.
36:36 You know, find a way that you can integrate what you're doing with, you know, in your real
36:41 world life with what you're doing in your computer life.
36:44 Right.
36:44 And see if we can put those together.
36:46 I think there'd be awesome IoT stuff to do with agriculture.
36:49 Yeah, for sure.
36:50 I think so, too.
36:51 You know, I've heard about like a lot of different projects that, you know, use IoT, you know,
36:57 particularly outside of the United States to do things like detecting diseases and, you
37:02 know, letting them know when's the right time to like manage crops and, you know, getting
37:07 information from, you know, weather APIs and like using it inside of their IoT devices and
37:12 stuff like that to help make decisions, which I think is really cool.
37:15 Yeah.
37:16 And, you know, when you think about.
37:18 You could look at the crops and say, how wet is this?
37:20 You know, could it hold out 12 more hours?
37:22 Because I see it's going to rain in 12 hours.
37:24 So, like, let's not waste the water now.
37:27 Save some.
37:27 Yeah, exactly.
37:28 Like little micro optimizations like that.
37:31 That'll probably won't save you a lot of money and resources.
37:34 But then also make sure that you're, you know, you can control your environment.
37:38 Yeah.
37:39 But yeah, I think those are all really cool use cases that, you know, we should definitely
37:42 encourage more folks to get involved in.
37:44 Yeah.
37:44 So I don't know if we should go down it, but Dean is calling Jordan the goat.
37:48 I don't know what's going on here.
37:50 I agree with him 100%.
37:51 I would defend that any day.
37:53 It goes Jordan, Kobe, LeBron.
37:56 That's how it goes in my head.
37:57 Awesome.
37:58 All right.
37:59 Well, that's all of our main items.
38:02 Brian, do you have anything extra you want to give a shout out to?
38:05 No, but I just wanted to say, I thought it was a trick question when you said, do you
38:08 know what Space Jam is?
38:09 And I thought everybody knew what Space Jam was.
38:12 I had to look it up.
38:13 I didn't realize it came out in 96.
38:14 So it's been a while.
38:17 Absolutely.
38:18 Yeah.
38:18 That's what I said.
38:18 If you're born after 2000, like, you know, what Space Jam is?
38:22 If you've got good parents, you'll know because they would have shown you.
38:27 I actually made my son watch it like a couple of weeks ago.
38:30 Yeah.
38:31 Did he enjoy it?
38:31 Yeah.
38:32 He loved it.
38:33 Now, you know, one day I came home.
38:34 He's just like, daddy, what are we going to watch tonight?
38:36 I'm like, I don't know.
38:37 What do you want to watch?
38:38 That's what Space Jam.
38:39 I'm like, yes, I'm a good father.
38:41 Yes.
38:42 Got it.
38:43 My wife and I tried to have our daughters watch all the James Bond 007 stuff.
38:49 The natural way would be to start at the very first one with Sean Connery and make
38:53 your way up to Daniel Craig.
38:54 And today they watched like 10 minutes.
38:55 Like this is so fake.
38:56 I can't watch this.
38:57 Yeah.
38:57 Different generation.
38:59 Different generation.
38:59 Yeah.
39:00 It's different.
39:01 All right.
39:01 So let's see.
39:03 Cecily, got anything you want to give a quick shout out to that didn't land in the main topics?
39:06 I feel like I should have prepared for this.
39:09 Yeah.
39:10 No, I don't think so.
39:11 Tell me about the Twitch.
39:12 Are you still doing the Twitch streams, Brian?
39:13 Yeah, we're still doing the Twitch streams.
39:15 Other Brian, Brian Clark.
39:15 My co-host Brian had taken some time off because Brian had a baby.
39:20 So congratulations to Brian and his family.
39:22 Congratulations.
39:22 But he will be back.
39:25 Well, he is back, but we'll be live streaming again starting next week.
39:29 Now that he's back and settled and stuff like that.
39:31 But yeah, we do a weekly live stream on Twitch.
39:35 So you can go to twitch.tv.
39:38 I think it is.
39:39 Twitch.tv slash Microsoft Developer.
39:42 It's every Wednesday at 1.30 p.m.
39:44 Eastern Standard Time.
39:45 And we just, you know, we talk all things Python.
39:48 We do different projects.
39:50 Yeah, I believe both of you gentlemen have been on.
39:52 We've had, you know, Brian come on to talk about testing and solve some problems that I was having.
39:58 And Michael, you came on too, which was great.
40:00 And yeah, we just, you know, we try and take a beginner's perspective.
40:05 You know what I mean?
40:06 You know, my Brian, not Brian on the stream, but like my co-host Brian and myself, we try to take it from the perspective of, okay, well, he knows JavaScript.
40:15 I know C#, let's come together and like play around with Python and, you know, show all the mistakes and the typos and, you know, the things that happen that we don't always see on video and live streams and show people like, well, you know, anyone could really just take the time to learn.
40:30 You just got to put in the effort.
40:31 Yeah, awesome.
40:32 Yeah, people should definitely check that out.
40:33 That's well done.
40:34 So before I give my quick one item that I want to share, Dean says, PyCon Israel is next week, May 2nd and 3rd.
40:42 It's free and virtual.
40:43 So all are welcome.
40:43 Yeah.
40:44 Thanks for that real time update.
40:46 And then, Brian, people are loving our, what you call it, the absolute privacy updates to the site.
40:54 Check this out.
40:55 154 people like some random update about removing analytics from the website.
41:00 I think that's great.
41:01 Yeah.
41:02 So now if you go to like pythonbytes.fm in Firefox and you look, there's perfect security shield, perfect privacy shield.
41:10 And we happen to be live streaming.
41:12 So did you just remove Google Analytics from it?
41:14 Is that what you did?
41:15 We were using GetClicky, which is like a more real time, but I think Google Analytics is basically the same.
41:22 The thing I liked about GetClicky is it was a paid service that didn't share your data with advertisers.
41:26 So it was better, at least in that regard.
41:28 But all the ad blockers and everything were already like degrading the data so badly that it was kind of like, well, it's maybe half of the population.
41:35 I don't know that we get information about it.
41:38 So let's just take it out.
41:38 Right.
41:39 Got it.
41:40 Got it.
41:40 Got it.
41:40 Got it.
41:41 All right.
41:41 I wish we would have had this joke last week, maybe two weeks ago, but I've got a good joke for us.
41:47 You know, there was that giant evergreen shipping container thing that clogged up the canals at the Suez Canal.
41:54 Costs like $400 million an hour lost commerce with the Middle East and Europe.
42:03 Right.
42:03 That was bad.
42:04 So there's this great joke here about Linux containers and Kubernetes.
42:09 So it's got the evergreen ship stuck sideways and like another shipping container clearly stopped.
42:16 Like this is blocked.
42:17 We can't make it through.
42:18 And then the title is Linux containers and Kubernetes for beginners.
42:21 Like containers.
42:22 Yeah, that'll fix it.
42:24 Hilarious.
42:24 That's hilarious.
42:27 By the way, did they ever get that thing out?
42:29 It got out like a week ago, I think.
42:31 Yeah.
42:31 Eventually they had to dig the sand out underneath it until it could float again, basically.
42:36 Oh my gosh.
42:37 That's ridiculous.
42:38 And then Cecil, are you a fan of the Oh Really covers?
42:41 I am.
42:42 Yeah.
42:42 Yeah.
42:43 Yeah.
42:43 So we've got the Oh Really instead of O'Reilly.
42:46 Kubernetes for beginners.
42:47 What could go wrong?
42:48 Dev oops.
42:49 Nice.
42:49 I like it.
42:50 Dev oops.
42:51 I like it.
42:51 But I love the evergreen container ship.
42:54 Containers.
42:54 That'll fix it.
42:55 That's hilarious.
42:57 Yeah.
42:58 All right, Brian.
42:59 Is that it?
43:00 Yeah.
43:00 Is that a show?
43:01 Put a wrap on it?
43:02 Nice bow.
43:03 Yeah.
43:03 Good job.
43:04 Good guest.
43:05 Yeah.
43:05 Great guest, Cecil.
43:07 Super to catch up with you.
43:08 Thank you for being on the show again.
43:10 Thanks, everybody.
43:11 Thank you both for having me come on, man.
43:12 Again, it's always a fun time.
43:14 I'm trying to break the record.
43:15 I want to know who your most frequent guest is and whatever that is, I want to break the
43:19 record.
43:20 Oh, I'm going to get one of those great IO type things and point it at our site and then
43:24 I'll ask it.
43:24 Yeah.
43:26 Let me know.
43:27 No, I think actually probably you're near the top.
43:29 I have to do some counting.
43:30 We'll have to see.
43:31 But yeah, for sure.
43:32 Yeah.
43:32 Let me know.
43:33 I got to make sure I keep standards high.
43:35 That's right.
43:36 Brett Cannon out there in the live stream.
43:38 If he's still there, he's definitely one.
43:39 He's one of the contenders as well.
43:41 So we'll let you know.
43:42 Okay.
43:43 Yeah.
43:43 Cool.
43:44 Well, bye, everybody.
43:45 Bye, everyone.
43:46 Take care.
43:47 See ya.
43:47 Thank you for listening to Python Bytes.
43:49 Follow the show on Twitter via at Python Bytes.
43:52 That's Python Bytes as in B-Y-T-E-S.
43:55 And get the full show notes at Python Bytes.fm.
43:58 If you have a news item you want featured, just visit Python Bytes.fm and send it our way.
44:03 We're always on the lookout for sharing something cool.
44:05 On behalf of myself and Brian Okken, this is Michael Kennedy.
44:09 Thank you for listening and sharing this podcast with your friends and colleagues.