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


Transcript #267: Python on the beach

Return to episode page view on github
Recorded on Wednesday, Jan 19, 2022.

00:00 Hey there, thanks for listening.

00:01 Before we jump into this episode, I just want to remind you that this episode is brought to you by us over at Talk Python Training, and Brian through his pytest book.

00:10 So if you want to get hands on and learn something with Python, be sure to consider our courses over at Talk Python Training.

00:17 Visit them via pythonbytes.fm/courses.

00:21 And if you're looking to do testing and get better with pytest, check out Brian's book at pythonbytes.fm/pytest.

00:28 - Enjoy the episode.

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

00:34 This is episode 267, recorded January 19th, 2022.

00:41 That's it.

00:42 I'm Brian Okken.

00:43 - I'm Michael Kennedy.

00:44 - We've got kind of a, I've got a cool green screen today.

00:48 - I know some days we have cool stuff to talk about and cool things to share, but you're taking it to the next level.

00:53 You are live streaming and recording right from the beach in Hawaii.

00:58 So yeah, I'm looking at it.

01:00 I'm so jealous right now.

01:01 So it's nice.

01:02 It's you could probably handle doing it more than one week, right?

01:06 You could just do this for a while.

01:07 Yeah, we should, I should move here about a month every year.

01:10 That'd be great.

01:11 But anyway, let's move on to our topics.

01:14 Michael, you want to talk about boxes?

01:17 I really do want to talk about boxes.

01:19 This is such a cool library that I found.

01:23 So here's the thing.

01:24 We have Python classes and we have dictionaries.

01:28 Where's all the data stored for most classes?

01:31 In the dunder dict, right?

01:33 Which is a dictionary of what is your field?

01:36 Here's its value, each instance of the class, each object gets its own instance of that dictionary, right?

01:41 - Yeah.

01:42 - And yet when we have a dictionary, we can't treat it, we can't get the values of the dictionary in the same way that we do of a class.

01:50 A class you say thing.field.

01:53 Well, wouldn't it be nice if you could go to your dictionary and say it has a key.name, So just d.name to access it.

02:00 That's the basic idea behind this thing called Box by C.D. Griffith.

02:04 And that was enough to get me interested and think, all right, this is a cool idea that I would love to play with, and maybe I should use it more.

02:14 But then I started to look a little bit further.

02:17 So if you go down here, it says, all right, well, sometimes these keys, they have a structure that won't allow you to treat them that way.

02:26 like a space or a colon in the example of spaces and colon.

02:31 >> Yeah.

02:31 >> So for example, they have a key that is the name of a movie and then data about that movie.

02:37 So Robin Hood spaces, colon men in tights with spaces.

02:42 By default, it'll actually convert that into something that you can use by just replacing spaces with underscores and colons just go away and stuff like that.

02:51 >> That's awesome.

02:52 >> You can still do that, which is cool.

02:55 But there's a lot more stuff it says, check out the box GitHub wiki, which is right on the homepage, the GitHub that I linked to. And there's all sorts of things. So they show start by showing just the basic stuff like here's a box and you just you can create it through keyword values or pass it a dictionary that'll initialize out of that. So they've got like funny movie equals something and you just say my box dot funny movie, just like it was a class. And that was like I described the first thing. However, there's more that you can do with it.

03:24 So if you go over to the types of boxes, they have conversion box, default boxes, box dots, camel killer box, which is awesome.

03:33 Frozen boxes, converters, so not just only will it work in all these ways, which I'm about to describe, it will convert to and from dictionaries, to and from JSON, to and from YAML, to and from message pack and CSV.

03:45 Oh, okay, so let's go to the types of boxes and check this out.

03:49 So by default, you get the conversion box, which is what I described where there's a space, it'll put an underscore.

03:55 >> Yeah.

03:56 >> All of them you can access in this key value way.

03:58 It's just a matter of what happens to the keys if there's a way to make them more accessible.

04:02 But you can turn that off. You can have a default dictionary, where if the thing is not there instead of throwing a key, or it'll create whatever you say the default is like, create a list because I want to add up things or create, start with number zero because we're trying to count each one of those as we build it up or something like that.

04:20 So it can also be a default dictionary, they call that a default box, which is cool.

04:24 It can also do what it calls box dots.

04:29 So in a string, you can traverse the hierarchy of the stuff contained in the box through the dot notation. So you could say, you know, my box dot a dot b dot c, and it has this fluent interface where the thing that it returns from each level is either a primitive thing like a number, but if it's a sub dictionary, it'll return a sub box, I guess, right?

04:52 So you can keep going on it.

04:53 You can also then just say, quote, a.b.c to traverse that hierarchy as a string if that's more programmable.

05:00 This one is great.

05:01 Are you working against an API or some data source that is written in a different language style?

05:08 So especially I'm thinking C# here where it's not lowercase and underscores as a separator but it's capitalization, camel case.

05:16 Like the example they have is pesky and annoying keys, which is capital P, capital A, capital A, capital K, all one thing.

05:24 And like, if you're gonna say dot the thing, well, guess what?

05:27 You're gonna have to write that in your code, right?

05:30 - Yeah.

05:30 - Unless you make it a camel killer box and then it converts it to snake case, pesky underscore and underscore and annoying and keys.

05:39 So if you program against an API that's written in another language, you can still do this Pythonic code, which is, that's amazing, right?

05:44 - Yeah, I like that.

05:45 That's great.

05:46 - I know, it's a good name.

05:50 - I mean, kinda.

05:50 - Frozen box.

05:51 - I would, it's a fun thing.

05:53 I personally wouldn't recommend it because then your code, it's hard to look up the documentation 'cause it'll be wrong, things like that.

06:01 - Yeah, maybe something more in the affirmative like snake case converted or I don't know, whatever.

06:06 They have a frozen box, so it's un-mutable and hashable, which is pretty cool.

06:11 - Yeah.

06:12 a recast, so if you put in strings to this key and you want it to be numbers, it'll always convert it to a float or whatever.

06:20 So those are all pretty awesome.

06:22 And then it'll even do things like put a prefix for stuff that couldn't be valid, non-quoted symbols.

06:30 You can say .name, but you can't say .327 name.

06:35 So you can say put an X, so it's X317 or whatever.

06:39 All those things are pretty awesome.

06:41 Let me go back here. The other thing is just the converters.

06:44 There's all the converters you might go to dictionary, to YAML, to TOML, and also from all those things, which I think is pretty neat.

06:53 What do you think? Like it?

06:55 >> Yeah, I do. There's times where I've really wanted to conveniently just create something with a dictionary, but I wanted to use dot notation, so I've used like a name tuple or something like that.

07:08 And this is actually, this does it for you.

07:12 So nice.

07:13 >> It's really nice. And I've done stuff like that as well.

07:15 Where I'm like, all right, I'm going to create a new class that derives from dictionary and just give it a set adder, get adder so you can do the dot thing on it.

07:23 But this seems to have just so many more other features on top of it that I don't think I'll ever do that again.

07:27 I'm just going to use this box thing.

07:29 It seems so much better.

07:30 >> Nice. It's cool.

07:31 >> So I think there's just a few comments that I got to bring in.

07:35 >> Yeah.

07:35 Roman Wright other points out that the setting default box is not the default setting, which is pretty awesome.

07:42 Yeah.

07:43 Chris May points out that for this, someone needs to think outside this package to get something outside the box, right?

07:50 To get something really amazing.

07:52 And just, you know, Brandon Brainer is a little bit jealous of your green screen.

07:57 Hey, that Brandon was the one I had as a guest for testing code recently.

08:03 - Hi, Brandon. - Right on. Yeah, very cool.

08:05 So, all right.

08:07 What's next?

08:09 What's next is mocking, sort of mocking. So, Adam Johnson has an article called Making Simple Mocks with Simple Making Simple Mocks with Simple Namespace and I had never heard of this so I'm really glad he wrote this article. It's really pretty great.

08:25 Do I have the wrong? Yeah, let's just cover this one. I need my notes. Never mind.

08:29 So, Adam's actually been crushing it lately. He's got a lot of recent blog posts. So good job, Adam.

08:35 The simple namespace is pretty neat.

08:39 It comes from the type standard library, so it's not an extra package you have to bring in, which that's cool. But one of the things, it's like normally we use unit test mock, or you can to mock something.

08:52 But one of the problems with mocks is by default, if you misspell something, it's going to be fine.

09:00 mock just lets you do whatever attribute access you want.

09:03 And that's usually not something you want.

09:06 >> Right. Usually the mock is like, let me just get in the way and just let things keep working no matter what.

09:12 Right? And just don't do anything unless you say return this value for this function call or something.

09:16 >> Right. You can pass in specs.

09:18 And if you have a known object that you're mocking, you use specs and that works.

09:24 But sometimes you don't need that much of stuff.

09:28 So simple namespace is a thing that just lets you fill in attributes.

09:32 And then it works to access them.

09:34 It works kind of like a name tuple or something like that, but the usage of it is super simple.

09:39 And then, and then you can pass this around.

09:42 And so in the, in the parlance of, of like testing, this would be for a fake or a stub, not really a mock cause you don't interrogate it.

09:51 But if you just need to fill it, have something that, that, you know, walks like a duck and quacks like a duck, you can use one of these to create a duck and have it get passed in.

10:00 It's pretty cool.

10:01 And super simple and really easy.

10:03 Love it.

10:04 - Yeah, it seems a lot like just what people would have expected Mox to do if you described it.

10:09 - Yeah.

10:09 So, he has a great quote.

10:13 It's as simple as possible with no faff around being callable or tracking usage or something.

10:18 So in a lot of sometimes with mocks, you try to interrogate.

10:23 So you have a function call and you interrogate the marks to say, did it get called by my code?

10:27 These don't do that.

10:28 You can't do that, but it, as long as, but you set it up with the attributes you want passed through, and it's pretty, just pretty neat.

10:37 I'm going to use these all the time now.

10:38 So yeah, it looks fantastic.

10:40 Very nice.

10:41 Find.

10:41 All right.

10:42 For the next one that I want to talk about, let's go to space, space, and embedded things in space.

10:49 So this is pretty fun.

10:51 This is an article on ZDNet talking about Raspberry Pis.

10:56 So apparently the European Space Agency has uploaded and installed and configured two new Raspberry Pis, and not just any Raspberry Pis.

11:09 They're these, what is it, Astro Pi?

11:12 That's what it is.

11:13 These are regular Raspberry Pi 4 boards, model Bs with eight gigs of memory that have been hardened for space.

11:21 Okay.

11:22 Wow.

11:22 Okay.

11:22 And the whole goal of having them up here is so that students and kids can write code and run experiments and just play with automation, but literally using the sensors of the international space station and actually writing Python code and machine learning stuff that runs up there in space.

11:41 Isn't that cool?

11:42 That's incredible.

11:43 Yeah.

11:44 Yeah.

11:45 So apparently there's 500 student programming teams in Europe who are all participating in this thing called the European Astro pie challenge, which is like an education focused, competition or startup or whatever.

11:59 Okay.

12:00 Yeah.

12:01 Very good.

12:01 So out of this world, it's out of this world.

12:03 Absolutely.

12:04 It's really cool to see Python in space.

12:06 Right.

12:06 And, here's just more of it, right?

12:08 So raspberry pies, you can, you can practice your stuff at home and then have it go up there.

12:14 Neat.

12:15 - Yeah, very cool.

12:16 So you have things like the humidity reading and board the ISS and the various sensors and things on there that you can work with and then just do science-y things.

12:28 I mean, when I was a kid, the science fair was like, well, let's make a little volcano that erupts and like oozes stuff out of paper mache.

12:36 And you know, these kids get to write code that runs in space.

12:38 That's next level.

12:40 - Yeah, I admit that I've never done the volcano thing though.

12:43 I kind of, I should do that.

12:45 >> Yeah, I haven't either very much.

12:46 I mean, I did some paper mache thing and I think I had a failed volcano once but that's about it.

12:51 Anyway, I just think this is really cool and it's a neat use of Raspberry Pis.

12:56 It's a cool way to take a semi-modern computing environment, put it somewhere neat where it has access to the real world and let kids and other researchers write code on it without going, "Yeah, we're not going to install your program on the ISS." No thanks to that.

13:12 >> This is so neat. I'm just blown away.

13:15 I would have never thought that something like this was gonna happen in my lifetime.

13:18 It's nice.

13:18 - Yeah, yeah, so many neat things.

13:20 All right, well, that's all I gotta say about that, but definitely fun.

13:23 - So one of the things that new coders have to deal with, and unfortunately it's hard to tell them ahead of time how to deal with it, is tracebacks.

13:36 So tracebacks are, they're just part of life with coding.

13:41 And Trey Hunter has an article called "Reading Tracebacks in Python." And it's a really great, simple introduction.

13:47 I love it.

13:48 One of the things I want to comment on is just the order in which we teach people things.

13:55 And teaching people how to do tracebacks is something that it really needs to be early.

13:59 Maybe like right before testing, and right after the hello world.

14:04 But seriously, tracebacks happen so fast and when you start coding, an assertion happens that you don't catch and you get a traceback.

14:13 and people panic and go, "Oh my God, I suck as a programmer." And you don't, it's not overwhelming, just kind of walk through it simply.

14:20 And that's what this article's about, is how to walk through it simply.

14:23 And so we're gonna, it's, if people are new to Python listening to this, or how to teach people, just teach people to start at the bottom.

14:33 You read the last line first.

14:34 So the last line in a traceback is the error message.

14:37 Let's scroll to one on here.

14:40 - Which is good to know, because that's not true for other programming languages, the error's at the top and it's kind of inverted.

14:46 - Oh, really?

14:47 - Yeah.

14:48 - I forget, but yeah.

14:49 So the last line is the exception and then also the message for the exception if it's there.

14:56 And then you read up.

14:58 And the next two lines up are, you've got a file name and a line number and then a copy of what the line is.

15:07 And that's the place where the exception actually happened.

15:10 And these two double things, these two lines, the line is called, what do you call it?

15:15 They're the stack trace, the stack, whatever.

15:19 - Yeah, call stack?

15:20 - Yeah, this is the call stack.

15:22 And that's--

15:24 - Even more so, 'cause you get lines within functions, right, not just the--

15:27 - Yeah. - Yeah.

15:28 - And then if you don't understand why you have an exception there, you just keep going up.

15:34 You keep going up to, and sometimes the exception happen not in your code, but in some library call that you went called.

15:42 So you're not going to debug that.

15:44 So you have to debug your code.

15:46 So it's good to go up enough to where it's in your code.

15:50 And then if you can't figure it out, you just keep going up.

15:52 And this example is actually not obvious to me what was going on.

15:57 So I'm glad he walks through it.

15:59 So Trey walks through how to read this and it goes up to the fact that, so this the example has a type error because you can't concatenate a string to an integer.

16:11 And that's weird because it doesn't look like it's trying to do that. But then he walks up to find out that the function is actually taking the standard input and passing it in as a number and one of the argvs and you have to convert it to an int first. But so that's a something I'm I'm glad you used that example because people new to command line interface coding often forget that, that the input is usually a string, even though if you pass in a five, it's still going to be a string with a five in it.

16:43 >> Right.

16:44 It looks like a number, but it's not a number.

16:45 >> Yeah.

16:46 So you have to convert those.

16:48 And a reminder here, this is user input, even in...

16:51 So in this case, it's not going to be harmful just to convert it to an int, but even command input is input from a user, so you have to sanitize it if you need, if you're doing anything like with a database or something.

17:04 - Absolutely. That's great. I think definitely that's the kind of thing you need to start with when you're teaching people Python. Like almost before you teach them to code, like how to, if you run into an error, here's how you understand it a little bit, and here's how you Google it or go about finding some way to fix it.

17:22 - Yeah, and if you start, especially if you start at the top, it's going to be a mess, because if you've got a call stack like 50 functions deep, hopefully not, it's going to be a really big trace back.

17:31 You don't want to try to untangle all of it, just start at the bottom.

17:35 >> Yeah, absolutely. Dean out in the live stream says, "You know, when you use some Python wrapper on top of a Java microservice and you get a 500 line exception, you're like, what have I done wrong to deserve this?" Yeah, that's like the advanced version of this.

17:49 >> Yeah.

17:49 >> Speaking of advanced, how about some intrigue?

17:52 >> Ooh, nice picture.

17:53 - Ooh, yes.

17:55 So, you and the listeners may have heard of this person who turned out to go a little bit bonkers on their open source code, luckily in NPM and not Python, so JavaScript space.

18:10 So there's colors and JS, which are two widely used, no padding margin, NPM libraries used for JavaScript and Node.js.

18:17 Well, this developer, Marak Squires, First they thought it was a supply chain vulnerability and somebody hacked the account.

18:25 But it turns out, no, no, no, Marek intentionally corrupted both of his libraries.

18:30 So they ran an endless loop spitting out random political messages while it would loop around and just fill the screen with garbage.

18:39 So initially thought to be a hack, but political and personal messages included in the code and on his related websites indicate that it may be the work of a disgruntled lashing out developer.

18:50 >> Wacky.

18:51 - Wacky.

18:51 - Wacky, okay.

18:52 So that's not, I was not gonna cover that.

18:55 I saw that and I thought that that was pretty interesting.

18:58 And then Mike LaFontaine points out, oh, Brian Krebs, the security guy.

19:04 I just noticed that this Myrax Squires seems to be the same fellow who's sabotaged two of his own popular open source libraries next week.

19:12 And he links to an article in my post, residents of Queen home with suspected bomb making materials charged for some sort of like terrorism type of thing.

19:26 So the same person who sabotaged their NPM packages then was like in the process of making bombs and it just kind of shows you an interesting spectrum of where all this stuff lands.

19:40 That's crazy, huh?

19:41 - Yeah, weird.

19:43 - Yeah, yeah, very weird.

19:44 Oh, I also forgot to point out, this is an extra, extra, extra section.

19:48 So, short, I got more stuff.

19:50 But the first one is, the guy that went and messed up all the stuff on NPM and everybody's dependencies recently has now been charged with creating bombs in Queens, New York.

20:01 So, yeah, there's that.

20:03 - Okay.

20:04 - Here's one that's really positive.

20:05 Andy Griffiths, don't know this person, but they posted something incredibly simple that is super helpful when you're building websites and trying to design them.

20:14 You know, you can go to inspect element and you can like hover over different parts of your page and highlight and it'll show, okay, this is actually the div here that is containing this and it has a margin and so that's why it looks like that.

20:27 - Yeah.

20:28 - This guy posted, "Hey, struggling with layout?

20:30 "Turn on CSS outlines, it's a superpower." And all you have to do is write this incredibly simple CSS.

20:38 Star is the CSS selector, outline colon 1px solid red.

20:43 And what you get is your entire site now highlights all the elements on the page so you can figure out how to style them.

20:49 - Oh, that's pretty cool.

20:51 - Given the amount of work, isn't that amazing?

20:54 - Yeah, yeah.

20:56 - So I definitely think this is something I'm gonna try to use when I'm working on design and stuff 'cause it's just so much easier than trying to like hunt around with like the debug tools and then you reload the page and it changes and all that.

21:10 So quick tip for people there who do web stuff, Python 3.10.2 is out and there's actually a decent amount of stuff shipped in it.

21:18 If I do some quick scrolly-scrolly, I would say that's like 30, 40 changes and bug fixes and so on.

21:26 - Wow.

21:26 - So things like fix hang in run test underscore MP due to race condition or fix this thing in documentation or fixed hash lib used for security option to work correctly with the new version of OpenSSL, fix memory leak in pyval.evalcodex.

21:44 That sounds like it might be used a lot of places and used in conjunction with the word memory leak.

21:49 That might be good to fix.

21:51 Anyway, I already installed this on all my servers and have it running production and nothing seemed to catch fire, so that's good.

21:57 - Yeah, very good.

21:59 - Yeah, so Python 3.10.2 is out, that's cool.

22:02 Ooh, all right.

22:04 One, I think one more thing.

22:06 Two more things.

22:08 Related, I'm doing a YouTube series on a bunch of little short Python lessons and I've got about a hundred videos I wanna make and I've made five of them and published or scheduled them to go out already.

22:20 So I've got a list, don't do this thing.

22:24 Anyway, a bunch of little tips like parsing data with PyDandic or counting the number of occurrences of items in a list or you've got foreign loops, convert them to list comprehensions.

22:33 These are all like four minute videos that just teach you something really quick in Python.

22:37 So if people are interested in that, they can click the link and then subscribe to my personal channel, not the Python Bytes YouTube channel, which is awesome, but doesn't have this content, to get more of those.

22:46 So that's fun.

22:48 - Cool.

22:49 How do you find time for all this stuff, Michael?

22:52 You're like everywhere.

22:53 (Michael laughs)

22:54 - I've been wanting to do some of these YouTube videos and just try and explore some of the ways in which people are presenting and teaching coding for like six months, and I've just decided I'm just gonna take two days and just gonna do it because I've been putting off for like months.

23:09 So there's that.

23:11 Speaking of time, I also am controlling our stream and doing all sorts of fun stuff with like this device called a Stream Deck, which you may have heard of.

23:20 The Stream Deck, you have one too, right?

23:22 But just not in Hawaii.

23:24 Stream Deck is this little device here that lets you basically set up a bunch of buttons and control things, which is super fun.

23:31 And it's built for streamers and whatnot.

23:34 I decided to see what you could do if, let's see, I pulled up the wrong link.

23:40 I decided to see what you could do around the Stream Deck and software development.

23:45 So, so far I have two profiles, one for PyCharm where you can control all sorts of things like click a button on your little device and it'll show your PRs or switch the select modes.

23:55 You can write and call it multi-columns and all sorts of stuff.

23:58 And then also one for Jupyter that'll like launch Jupyter and insert your standard imports and add cells above and below and rerun them or show me the command palette and stuff.

24:08 - Neat.

24:09 - So yeah, that also has a video on it as well.

24:12 And people can check that out, but I've got this YouTube profile, not YouTube, GitHub profile repository where it has all the profiles for the Stream Deck.

24:24 So if you want to download it, play with it, customize it, those are up there as well.

24:27 All right, that's it for all of my extras.

24:31 You got any yourself?

24:32 - Yeah, so I wanted to talk about, So this is a cool article by David Amos.

24:38 So David's awesome.

24:39 He's one of the gang, the people at RealPython.

24:42 But the article's three things you might not know about numbers in Python.

24:49 And I don't know where the line is.

24:51 Oh, it's near the top.

24:53 It's so awesome.

24:53 He's got a line that says, there's a good chance that you've used a number in one of your programs.

25:02 Yeah, I think so.

25:03 I could get behind that statement.

25:05 Yeah, so one of the things that like strings have functions attached to them. They've got methods.

25:13 And you know, we know that it's kind of different than other languages.

25:17 But numbers do too.

25:19 And this is something actually didn't occur to me.

25:23 That you can do like two bytes and stuff.

25:25 So there's functions that you can call on a number.

25:29 There's a trick though. You can't do like 255.toBytes, you have to put it in a variable name so that it doesn't think it's a decimal point.

25:39 And you also, or you can put parentheses around it. So you can do 255 with parentheses around it and then call toBytes or something like that. So there's, integers have two bytes, so you can convert it to bytes.

25:53 You can use the class method from bytes.

25:56 And you can also do like bit length and a bunch of other functions that are pretty cool around integers, which is neat.

26:04 And then floats have their own methods.

26:06 Floats have like is an integer or is integer ratio, or as integer ratio, so it'll convert it to an integer ratio. That's pretty cool.

26:15 Oh, wow. Like some sort of approximation in rational numbers like...

26:20 Yeah. So, yeah, I don't have that example pulled up.

26:25 No, but that's cool.

26:26 There's some, I'm there.

26:27 No idea about this stuff.

26:28 Yeah, I've got a bunch.

26:29 There's a there's a.

26:30 There'll be some links in the show notes to the Python documentation for these.

26:34 It's pretty nice.

26:36 The the OK, so that's the first thing that you should know about numbers is there's methods there, so look him up in the documentation and I'll will have links to the documentation.

26:46 And then the second thing you should know about numbers.

26:49 Second of the third is numbers have hierarchy, so there's there's four.

26:55 For abstract types in Python for numbers, there's complex, real, rational, and integral.

27:02 So complex is the complex.

27:05 Most of them only have one type in it.

27:07 Complex, the abstract type of complex has complex.

27:12 Real has float.

27:13 Rational has fraction, but integral has both int and bool.

27:17 So that's neat.

27:18 Their bool and ints are related.

27:21 And then, but then we also have these decimals.

27:25 yeah, so there's, I wanted to find his stuff on decimal.

27:29 Decimals don't fit.

27:30 So decimals have their, they're not really part of this hierarchy at all, but they're, they're their own decimal class.

27:37 So there's not, there's not an abstract class, but that's okay.

27:41 Decimals are great.

27:42 And people should remember decimal is around if you have, if you're working with money or something like that, Use super precise science.

27:50 so yeah, these are good.

27:52 also, because these are just normal types, numbers are extensible.

27:58 Oh yeah.

27:58 A comment about floats are weird.

28:00 Yeah.

28:01 those are always weird.

28:02 Floats are weird.

28:03 Yeah.

28:04 The numbers are extensible since these are classes, you can, you can derive from them.

28:09 but he comments, which is good.

28:12 You have to be really careful because if you, want to extend a class, there's a whole bunch of dunder methods that you have to make sure work right.

28:20 So maybe you don't want to extend it, but you can, you can make your own numeric types.

28:25 So this is the third thing.

28:27 Anyway, kind of a neat article.

28:28 >> I'm trying to wonder what you might actually create those for.

28:32 I mean, maybe you might, well, maybe we'll create an integer that has a bounds and is an error if you try to make one too large or something.

28:39 >> Yeah, I'm not sure.

28:41 >> I'm thinking on the spot here.

28:43 >> Yeah.

28:44 Another thing that's amazing is a complex numbers are natively built into Python.

28:50 >> Yeah, and that's really great.

28:52 That's essential for a lot of scientific and measurement work and stuff is to have complex numbers around.

28:59 >> They're truly amazing.

29:01 All right. Well, I think that's all.

29:04 I mean, I already did my extras.

29:05 I skipped your set here, your articles to ask you about your extras.

29:09 Do you have any actual extras you want to cover?

29:10 >> I don't have any actual extras.

29:12 - Have you had any dangerous encounters with like, warm water, have you maybe stubbed your toe on a rock, or was there a turtle that came by, or you could run into like an eel, there are eels in the reefs there that you might wanna stay with.

29:26 - I've only been here a couple days so far, we've been, I've been swimming a couple times, right out, right, like, you can, you have to look down, not across, to see the beach from where I'm staying.

29:37 And so I went swimming right here, it's kinda fun because it drops off right away, So there's a little beach and then it drops, it drops deeper right away.

29:45 And that's, but it's not like a big current.

29:47 So you can swim really with only going out a few feet, which is nice.

29:51 And then we went to another beach that was like shallow for a long time, but then it had coral and stuff.

29:56 And that was really fun to scuba dive or to not scuba, but, snorkel over.

30:01 and look around.

30:03 But if you're just wanting to walk out, that corals like tough to walk on and it hurts.

30:09 Yeah.

30:10 That stuff's super sharp.

30:11 >> Yeah.

30:12 >> Beautiful.

30:13 >> But having a lot of fun.

30:14 >> Awesome. Good to hear. Well, I think we should round it out with one or two things here.

30:19 We got some jokes.

30:21 Now, I saw Josh out in the audience and he sent in some jokes, which we'll make part of this soon, but I didn't have time for this episode.

30:27 We got four O'Reilly book covers.

30:31 >> I love these.

30:32 >> Not the O'Reilly, because the O'Reilly books, they always have an animal and a title and whatnot.

30:39 So O'Reilly art takes that kind of puts a funny spin on it.

30:43 I'll do this first one.

30:44 We got 40, maybe we could do two each.

30:46 So the first one here has a platypus on the screen.

30:48 It says, the little subtitle is, the quote is, "The original developer isn't here for a reason." And the title is, "Losing your will to live, a code maintenance guide." - Yes.

31:00 - Written by the intern.

31:03 - The intern.

31:04 - You wanna take this one?

31:07 So the title is "Expert Vague Understanding of Computer Science.

31:13 Probably be able to explain a sorting algorithm if it ever comes up." By the practical dev?

31:20 Yeah, by the practical dev. Very good. Very good. Okay.

31:23 The next one is an elephant. Very proud speaking out loudly.

31:28 "It depends, the definitive guide. The answer to every programming question ever conceived." It's a short book.

31:37 - Exactly. (laughs)

31:39 All right, bring us home with this last one.

31:42 - Okay, so, "Works on my machine," "The Definitive Guide," "How to Convince Your Manager." Yeah.

31:50 - I love it.

31:51 Very good, very good.

31:54 Well, Brian, everyone listening, almost everyone is jealous.

31:58 I'm sure there's some people in Hawaii like, "Yeah, I just go there every day." But most of the people are probably jealous where you get the record from today.

32:06 So thanks for making the time.

32:07 - Thank you.

32:08 It's fun, always fun to be here with the Python Bytes people.

32:12 - Thanks for listening to Python Bytes.

32:13 Follow the show on Twitter via @pythonbytes.

32:16 That's Python Bytes as in B-Y-T-E-S.

32:19 Get the full show notes over at pythonbytes.fm.

32:23 If you have a news item we should cover, just visit pythonbytes.fm and click submit in the nav bar.

32:28 We're always on the lookout for sharing something cool.

32:30 If you wanna join us for the live recording, just visit the website and click live stream to get notified of when our next episode goes live.

32:38 That's usually happening at noon Pacific on Wednesdays over at YouTube.

32:42 On behalf of myself and Brian Okken, this is Michael Kennedy.

32:46 Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page