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


Transcript #205: This is going to be a little bit awkward

Return to episode page view on github
Recorded on Wednesday, Oct 21, 2020.

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

00:03 to your earbuds. This is episode 205, recorded October 21st. I'm Michael Kennedy.

00:09 And I'm Brian Okken.

00:10 And this episode is brought to you by us. More about that later, how you can support what we're

00:15 doing right now. Brian, I'm really sorry, man, but I've got something a little bit awkward to

00:20 talk about.

00:20 Well, this is awkward.

00:21 I know, but luckily it's just you and me, so you don't mind if I just sort of

00:25 tell it to you straight?

00:26 Yeah, just tell me.

00:27 Okay. All right. Well, sometimes I have an array and it's perfectly tabular. Like it's,

00:32 it's maybe just a linear array or sometimes the array goes across like every entry is like 20.

00:39 It's like a list with like 20 length, 20 lists in it. It's all the right size, but sometimes,

00:43 you know, maybe it's, it's the wrong shape and it's awkward and it's hard to deal with in Python.

00:48 You know, a lot of array processing happens in NumPy, but NumPy is all about rectangular like

00:55 things. And so if you've got data, that's kind of like an array, multi-dimensional array, but it

01:00 doesn't fit that shape. What do you do?

01:02 So, Simon Thor sent us a message and said, you all should talk about awkward arrays.

01:08 So awkward arrays, this is a, it's actually a pretty advanced library. So it's a little bit

01:16 like NumPy and it has NumPy like idioms and so on, but it's a library for nested variable size data,

01:23 including arbitrary length lists, records, mixed data types, missing data, and all those things and

01:30 dealing with those with NumPy like idioms. So it's better for handling, you know, like at what I

01:37 described, not the same shaped data. It's kind of the same dimensions, but it's not always the same

01:42 length on the various parts. And you could even use it with things like Numba to JIT compile the code to

01:49 make it even faster. And they just announced version 1.0 of this library, which was originally

01:55 written in Python. So it was good, but not super, super fast. And they rewrote the core in C++.

02:01 So now it's like a lot of the data science stuff, C++ at where the, in the business end of the

02:08 library. So it's super fast. Nice.

02:10 Yeah. Pretty cool. And what do you think about the logo?

02:12 The logo is actually great. It's awkward array, but the second array is below awkward and the A is

02:20 capitalized. So it sort of runs into the K and the W and the F to squish out of the way. It's very

02:26 clever.

02:26 Yeah. Kind of bent and awkward looking. Yeah. It's pretty clever. I like it as well. Another thing

02:31 that I thought was interesting, if you open up the link over there, you don't have to, but if you were

02:35 to go there, like right on the page, it says, here's the Python quickstart. Oh, and here's the C++

02:40 quickstart. So this library, the internals of it are written in C++, right? Okay. So that it's fast

02:46 from Python, but also you can go straight to the template library side of C++ and use it directly.

02:52 If you are say building some stuff in C++ and also want to use this library, or maybe you're building a

02:57 library that does data sciencey things and you have a big C++ C component aspect of it, you could use the

03:04 C side of it directly there. Nice. Yeah. So that's actually something I don't see almost ever is here's

03:09 the Python library and the C++ API that corresponds to it. Yeah, that's pretty cool. Also, it's,

03:15 I have a lot of cases for this. I'm going to definitely check this out. This is great.

03:20 Yeah, it's pretty cool. So thank you, Simon, for sending that in. Last quick note is when you install

03:24 it, you pip install awkward, the number one, not just awkward. I think awkward, which my gosh,

03:32 it's just so weird to have a package called awkward, but it's great. Anyway, I think awkward is the older

03:39 version and awkward one is this new 1.0 release. I think it's the same library. I wasn't sure if like,

03:45 I was like, okay, if this is awkward one, what is just awkward by itself? It's got to even be more

03:49 awkward, but I think it's the same library. It's just a different API version. Okay. Okay. Yeah.

03:54 You might be surprised by it, but nonetheless, it's, it's pretty good library.

03:58 You want to check it out. Yeah. You got any surprises for us? Yeah. The surprises came from Ned

04:03 Batchelder. So, Ned surprised us with, some surprising order dict, ordered dict surprises.

04:10 So I think we've covered this, but in Python three, six dictionaries changed a little bit. So normal

04:15 dictionary, just, if you just say dict or just declare one, they retain their insertion order.

04:20 If you list them out again, or just, you know, say, you know, if you have X equals some dictionary

04:26 and print X on the, the REPL, it'll just print it in the same order it arrived in.

04:31 Right. And if you do like four K comma V in, you know, dictionary dot items, you'll get them in the

04:38 same order now, which is nice. I think probably one of the most annoying things was if you are saving

04:44 a dictionary, if you're going back and forth between a JSON file into a dictionary and then you save it

04:49 again, right? Like that could just randomly be changing before. Whereas you'll be getting like,

04:55 yeah. Diffs on that file. Anyway, like this stability is nice.

04:59 I really like it, but I just sort of assumed I knew there may have been some differences. There's

05:03 still a collections dot ordered dict that is, around it's still around and there's a few reasons

05:10 for it. And then one of them is just because it's a class that some other stuff derives from and it

05:15 would break backwards compatibility to, to remove it. So I'm glad it's still there, but Ned brings up a

05:21 couple of surprising things around it. The first actually wasn't that surprising to me. What the, they're ordered, but you can't get access them by order. You can't say,

05:30 give me the first one by like saying like brackets zero or something. Does it surprise you? It doesn't

05:36 really surprise me.

05:36 Not really. I mean, I would just do, maybe just get the, yeah, just get the first thing out of items

05:43 and then just be happy with that. I don't know. But yeah, there's no way to like index like bracket zero

05:48 Right. That's okay. The thing that actually I didn't really think about before was that, Ned brings up is that how equality and order mix. So in the dictionaries for Python 3.6 and above now, if you declare two dictionaries with the same content, but they have, they've, they've, they're created in the different order. They're still going to be equal. So two dictionaries are equal if they have equal contents.

06:14 It would super bug me. Like if I have a equals one, B equals two, or B equals two, A equals one. Like if the dictionary contents are the same, but the order changes and you're, they, they say they're not equal. That would, I mean, that would bug me. I think.

06:28 Right. But order dict, apparently it does matter. So if you, if you care about order, you can use order dict to make sure they're in the same order.

06:36 Yeah. I guess you're explicitly saying I super care about order. So if the order changes, they're not the same.

06:41 Yeah. Yeah. So just a little surprise, surprise, surprise, but thanks Ned.

06:46 Yeah, that's cool. I, I wouldn't have known that. That's pretty neat.

06:50 Speaking of knowing stuff, you and I work on a few things. We've got some Patreon stuff going on. A lot of ways people can support us. I'll just really quick shout out. As a lot of people know, if you want to get better at Python, learn some things,

07:01 check out training.talkpython.fm. We've got a ton of classes coming up on almost 200 hours of polished Python content over there, which is pretty crazy.

07:11 Yeah. And I love the content there. We now have 55 supporters on Patreon, which is super cool. And if you go to any of our show notes, there's a Patreon link on the side. You can click on it. And, and a lot of people are just sending a buck a month and it's just awesome, but it adds up and it helps out.

07:27 Yeah.

07:27 Thank you.

07:28 Yeah. It definitely helps out covers operating expenses like editing and transcripts and whatnot.

07:33 Yeah. So what'd you got next for us?

07:36 I have a follow on to a follow on to a follow on. How about that?

07:42 That's great.

07:42 Yes. So we spoke about black cell magic, which is a way to type a thing into a cell in Jupyter and have black formatted. And a bunch of people said, Oh, and there's this and there's that. And there's all these great things.

07:56 And you covered, I think it was NB, NB QA.

07:59 QA. Yeah.

08:00 I wasn't sure the last letter QA, which is cool.

08:03 So that's kind of like a bigger set of tooling and other libraries along with black on top of that.

08:08 But one of the things that bugs me about Jupyter notebooks is they just seem to lack some of this like proper editor support and black like format code is one of those, but it's not the only one that bugs me.

08:22 And it took me a while to kind of get the Zen of notebooks.

08:24 Like, why do I create one of those instead of something else?

08:27 And what's the flow?

08:28 And I really do find them valuable, but it drives me crazy that if I type, you know, class object library dot, I just have to know.

08:36 Like, there's no help.

08:38 I have to know what I'm supposed to type.

08:39 And then when I type it out, I say parentheses.

08:43 And there's some number of arguments that go into this function call or whatever.

08:47 I have to just know the order, the type, the name, everything.

08:50 Now, before someone mails in, I know I can type thing dot and then press tab and it'll come up in a list.

08:58 But like this, like, please help me out on request.

09:02 I don't know.

09:03 It's like just typing dot should just I should be able to just flow and not have to like, OK, type.

09:08 And then, OK, now what's the documentation again for the signature?

09:11 Where is it defined?

09:12 All those kinds of things.

09:13 So there's this cool project that was sent in by Anders Kalmer called JupyterLab LSP for Language Server Protocol Integration or more.

09:26 It rolls right off the tongue.

09:29 Language Server Protocol Integration for JupyterLab is its official name, but it's super cool.

09:35 It brings a lot of these things that I felt were missing from the Jupyter experience.

09:41 So if you go there, you'll see that there's a bunch of examples, example code, which shows Python.

09:46 It actually works in R, Bash, TypeScript and a bunch of other languages.

09:49 So here are some of the things that are supported.

09:52 One, if I hover over a piece of code, if an underline appears, you can press control to get a tooltip with a function and function or class signature.

10:02 You can get documentation and other information about it just by hovering.

10:06 It'll show you, like, if you write code that's bad.

10:09 Like in Jupyter, if I write code that's bad, it just looks like code that's good, except for it won't run.

10:14 Whereas here, it'll put little squigglies under it and say, there's something wrong with this.

10:17 Or there's a warning here.

10:19 You're doing something wrong.

10:21 So editor stuff like that.

10:22 Jump to definition.

10:23 So you can right click and say, take me to where this variable or this function is defined, which is pretty awesome.

10:29 It'll highlight your references.

10:31 If you place it on a variable like in PyCharm, you've got a variable and you put your cursor on it.

10:38 Like all the places where it's used or defined light up.

10:41 So like that.

10:42 Yeah.

10:43 And, ta-da, auto-completion.

10:45 If I type the character dot, it will know that I want auto-complete so I don't have to keep typing stuff.

10:51 That's pretty cool.

10:52 And then on top of that, it has rename refactorings.

10:56 So you can rename stuff across your cells and things like that.

11:00 Oh, that's great.

11:01 As well as files.

11:02 So, you know, not groundbreaking, world-changing, but it definitely seems like it will take it up a notch in your Jupyter experience, right?

11:11 Just to bring it a little closer to editors like PyCharm and VS Code.

11:14 And it proves the point that the hardest thing in computer science is naming.

11:18 That's right.

11:18 We have a whole function when you get that wrong.

11:22 That's what you do.

11:23 Yeah.

11:23 But I mean the name Jupyter.

11:26 Jupyter.

11:26 Jupyter.

11:28 Jupyter dash.

11:28 Jupyter lab dash LSP.

11:30 Yes.

11:31 Indeed.

11:31 Right.

11:32 All right.

11:34 What's this next one you got?

11:35 Well, speaking of Jupyter, I guess it's a little related.

11:38 This is a project that is implemented as a Jupyter book.

11:42 I'm not sure if we covered Jupyter books, the Jupyter book project before, but it's a pretty neat documentation system.

11:49 This is open source tools and data for music source separation.

11:54 I was researching music, Python music tools recently, came across this.

11:59 And it's really cool.

12:01 So what it is, it's an online book powered by Jupyter book.

12:05 The authors are Ethan Manilow, Prem Sutherman, and Justin Solomon, I think.

12:12 And it's a tutorial intended to guide people through modern open source tooling and data sets for running, evaluating, researching, and deploying source separation approaches and focuses on music.

12:24 Now, that's a mouthful.

12:25 Now, that's a mouthful.

12:26 And maybe that's a limited set of people.

12:28 But it's really neat.

12:29 It uses Python.

12:29 It uses Python.

12:30 It uses Python.

12:31 And it has interactive demos.

12:33 Things with things with audio are way easier to visualize if you have a waveform in front of you.

12:39 And this uses waveforms and stuff.

12:41 It's beautiful.

12:42 One of the things I want to highlight is there's a basics of source separation section.

12:46 And that includes a primer on digitizing audio signals.

12:50 And it looks at frequency, time frequency representations, what phases, some evaluations and measurements.

12:58 Anyway, I think this is the best reference for understanding digitizing signals that I've seen so far.

13:04 It's really great.

13:05 Oh, this is super cool.

13:06 I think maybe the most generally useful thing at all, this is the whole Jupyter book way to create something like this for any knowledge base.

13:14 Yeah, I'd love to see how they do it.

13:16 And it's a creative commons sort of thing.

13:18 They got links to their GitHub repo so anybody can see how they do this.

13:22 So it's really cool.

13:23 I like it.

13:24 Yeah.

13:24 Yeah, it's super cool.

13:25 And they do have it on.

13:26 It's open source on GitHub.

13:28 So that's pretty sweet.

13:28 I do have a complaint, though.

13:30 Okay.

13:31 This is a big deal.

13:31 So there's a section in here on the basics of phase and phase trend, like waveforms and what phases and so on.

13:39 There's some formulas in here where they define J to be the square root of negative one.

13:44 We all know that I is the square root of negative one.

13:46 Come on.

13:47 I mean, it's an imaginary number.

13:52 It doesn't start with J.

13:53 There's an I.

13:54 Sorry, carry on.

13:57 That phase thing is gorgeous.

13:59 It's got, anyway.

14:00 Yeah, the animations and phase is actually really nice.

14:02 Yeah.

14:02 To tell you the truth, I deal with like signals all the time.

14:05 And if you want to get into the math, the math is here.

14:08 So this is, this actually would be a great actual textbook for a university course.

14:12 But I just skip over the math part and read the explanations and stuff.

14:17 It's still useful.

14:18 Yeah.

14:18 Quite neat.

14:19 All right.

14:19 Let me ask you a question.

14:20 Okay.

14:21 You've done C++ ton.

14:22 You still do it every now and then, right?

14:24 I do it every day.

14:25 Yeah.

14:25 Right on.

14:26 Python have pointers.

14:28 Somewhere.

14:28 I guess.

14:29 It's got to.

14:30 Does it have value types?

14:32 Like non-pointers?

14:33 Can I have a thing that doesn't behave like a pointer?

14:35 I think of it more like references.

14:37 Yeah.

14:37 All of Python seems like a reference.

14:39 I want to cover an article, Passed by Reference in Python, Background and Best Practices from

14:44 the Real Python crew.

14:45 And also, I just apparently failed this job interview.

14:48 By Marius Mogiarosi.

14:53 Hopefully, I got that somewhat close.

14:55 So, Marius wrote this article over there on Real Python, which is pretty interesting.

15:02 And it sort of compares languages that have explicit.

15:05 You can explicitly work with things as references or pointers, or you can work with them as local

15:11 value types.

15:12 And then sort of compare that, like there are certain types of problems you might solve

15:16 or address or algorithms over there that don't necessarily make a lot of sense in Python.

15:20 So, how would you simulate some of those behaviors?

15:23 So, Python's interesting because in the guts, like everything is a pointer.

15:28 Even the number four.

15:30 If you ask, like the number four in C.

15:33 If I said four, how many bytes would you think that would take?

15:36 It depends on the, in C?

15:37 Yeah.

15:38 It's the machine type.

15:40 Right.

15:40 So, probably four or eight, something like that, right?

15:42 How many bytes?

15:43 Yeah.

15:43 Yeah.

15:43 Yeah, exactly.

15:44 And when you create one, it would be associated with the stack, unless you did some funky stuff

15:50 to like allocate it and like, you do it in like an amper to get the address.

15:53 But by default, it's like, it comes on the stack and you pass it around and makes a copy

15:57 of it.

15:57 In Python, the number four is a pointer.

16:02 It's a C, it's a pi long object out in the heap.

16:07 And it takes like 28 bytes.

16:08 Like the number four takes 28 bytes, which is pretty interesting.

16:11 But so, everything, like even basic numbers that seem like they just might be values are

16:16 like in the guts, these sort of reference types.

16:19 But the function passing behavior is, they say it's something called pass by assignment,

16:26 which I'll go with that.

16:28 So, when I pass in, like if I create a variable, say x equals four, and then I pass the x to

16:34 a function and that function changes the value of x, it's changed for the function, but not

16:38 for the global thing that had it before, right?

16:41 Yes.

16:41 Well, in C or C++ or C#, like all the examples here, actually C#, you can say,

16:47 no, no, no.

16:47 Pass it so that if the function changes the variable, the one where it came from also changes,

16:52 right?

16:53 I can pass the, I guess in C, that would be the pointer to the pointer, and you would

16:59 make a change to the pointer.

17:00 In C#, you would say ref or out or something like that, and it would make a change on the

17:06 other side.

17:06 So, how do we do that in Python?

17:08 And like, what are some of the interesting things that you might do?

17:11 I said, well, Python doesn't have value type, so it doesn't, one of the problems with the

17:16 value type world is like, maybe if I created a class, let's say a class in C++, and I create

17:22 it on the stack and I pass it, it's, I think it can make a copy of that, is that right?

17:27 Anyway, it's definitely, if you don't use the new keyword, like these pass by values are

17:31 making copies of the data that's passed around, that can make things slow.

17:35 Python, everything at some level being a pointer, doesn't have that problem, so that

17:39 doesn't apply.

17:41 But how do you implement these algorithms?

17:43 So, it says, well, if you want to actually have the function make a change, you can do

17:49 a couple of interesting things.

17:50 Like, you could, suppose I want to pass in a variable, maybe have that variable change,

17:55 but also get like a true false back, like it worked or it didn't work or something along

18:00 those lines.

18:00 So, they said, look, you can use tuple unpacking to return multiple values, the return value

18:07 and then the modified value, which is one.

18:09 Another thing is you could pass in a mutable data type, like I create an object and change

18:13 a field on the object, right?

18:15 So, that would have this.

18:17 Or list.

18:17 Or list, or yeah, anything that is mutable, basically.

18:20 Right.

18:20 Or another interesting one would be returning optional value types.

18:25 So, if I had like a function that would say, like they would say, okay, we're going to

18:29 try to parse a string into an integer and I either want to tell you, here's the number, the

18:34 integer you got, or it didn't work.

18:37 Forget that you might throw an exception, but suppose for some reason, this example, you

18:41 don't want to throw an exception, right?

18:42 What do you do?

18:43 Well, you could return the value and whether or not it worked as a tuple.

18:48 And that's one thing.

18:49 Like in C#, the example they say is as a tripars takes a string and an out integer,

18:55 which is like a one way ref type of thing.

18:59 So, how do we do that in Python?

19:00 Well, you could do just this multi-value, multi-return value, tuple unpacking, like it

19:05 worked and here's the value, or it didn't work and there's no value, which is, I don't really

19:10 love that one.

19:11 One that kind of is interesting is like, you could use optional types.

19:14 So, you could return an integer and if it's not parsable, you return none.

19:19 And then use the walrus operator to say like, value colon equals, try to parse it.

19:24 If that's not none, then you're good to go.

19:25 That one's kind of okay with me.

19:27 How do you feel about this, Brian?

19:29 I feel like people are trying to force non-Python programming styles into Python.

19:34 Yeah.

19:35 It's interesting.

19:36 It was reading through, it just made me think about, think back to my C++ days and all these

19:40 patterns of passing variables and changes and, you know, passing by reference, copy, copying

19:46 values and all that stuff.

19:47 It's probably worth reading, I think, even if you don't necessarily need to do it that much.

19:51 Yeah.

19:51 I actually like to be more explicit and have either do functional programming where you're,

19:57 I like the functional model where you, you pass in data and you return the, return the

20:02 modified.

20:03 Yeah, exactly.

20:04 The other approaches to, that I like is to know, I mean, you have a shared data that

20:09 you're pointing to, that they're, you know, you're past a modifiable data, like a list

20:15 or something and say, hey, this function, and it needs to be obvious, like fill out the

20:20 data, you know, it needs to be obvious that the thing you're calling is going to change

20:24 that or use a database to reference changeable stuff.

20:28 Yeah, a lot can be done with data structures.

20:31 Anyway, I thought it was interesting to compare these other styles of programming to how you

20:35 might compare, get them done in Python.

20:37 And I think I'll go for the optional.

20:38 If I had to pick one of these to write, I think I would go for the optional try pars that

20:42 returns none.

20:43 If, you know, if it doesn't work.

20:46 Assuming that you don't want exceptions, right?

20:48 Right.

20:48 And I mean, that's also like the default.

20:51 If you've got like the return of a value in, in some nested data or logic and you don't

20:59 return anything, otherwise you're going to return none.

21:02 So.

21:02 Yeah.

21:03 Yeah.

21:03 You know, when I first started learning Python, that's something that was strange to me is

21:07 that every function returns a value.

21:09 Even if the word return doesn't appear in the function, it just happens to be none.

21:13 Like the fall through case sort of in there is return none.

21:16 If nothing happens.

21:18 I kind of forgot that that's not obvious.

21:19 Yeah.

21:20 Yeah.

21:21 But that's, that takes some getting used to because all the other languages you say

21:25 it returns one of these things.

21:26 If you want to return something, you say return none at the end or something.

21:30 Anyway.

21:31 Yeah.

21:31 A lot of interesting ways to think about passing variables and some of the patterns

21:35 there.

21:35 Yeah.

21:36 My head hurts.

21:36 So if we're going to write some, some of these down, maybe you should just put them in and

21:40 get up and store them.

21:41 Huh?

21:41 I apologize again.

21:42 I think somebody on Twitter sent us this, but I couldn't find the reference this morning.

21:46 This is a really cool thing.

21:48 The author is Wei Wang, I think.

21:50 Goes by only Wei on GitHub.

21:53 And it's a tool for visualizing Git concepts.

21:56 And I absolutely love this.

21:59 He actually references a Git basics page, which is, I forget where that's at, but it's a good

22:05 explanation, but it's a, you know, it's a visual, not really, it's like a static thing

22:10 that you read about all the different ways and all the repos and where they are and everything.

22:13 And that's, you kind of have to read that once, even though if it doesn't make sense,

22:17 read something about how Git goes together.

22:20 But this visualizing tool is super cool.

22:23 The one he's, he's put together, it says visualizing Git concepts in D3.

22:28 And it just nails the things home.

22:30 It's really cool.

22:31 It's got these, all these different concepts like commit, branch, checkout, checkout with

22:36 a B, reset, revert, merge, rebase, tag, fetch, pull, push.

22:40 And you just start out with a, like a diagram of what your repo looks like with branches and

22:47 everything in the dots.

22:49 And then on the left side, you can type commands and you, you don't have any code you're changing.

22:54 You're just, you're just typing these commands to see what it does to the, the repository tree.

22:59 And it'll like add nodes and add tags and things move around.

23:04 And it's like light bulbs go off in your head where you're like, oh, that's what's happening.

23:10 When I do a checkout, all I'm doing is looking at a different branch and that's it.

23:13 Yeah.

23:14 It's pretty cool.

23:15 So yeah, it's this cool interactive command thing.

23:17 Like you said there, what if I type this and this, what if I do like two commits and then

23:22 a branch and then a commit and then check it out the other branch and do a commit.

23:26 How does that whole thing look?

23:28 Yeah.

23:28 It's pretty nice.

23:29 And it tells you like, there's a little instructions around each little lesson to like describe what's

23:35 going on and then suggest things to try.

23:38 But the interactive thing, you can do whatever you want within it.

23:41 You can, you can try things out and it doesn't, it doesn't handle all of the things.

23:45 Like for instance, I tried to get checkout with a dash for the last branch.

23:50 That's not implemented.

23:52 It's not there.

23:52 So, but, but it's pretty cool.

23:55 You know, another thing that's nice about it.

23:57 I mean, the fact that it doesn't support everything isn't necessarily ideal.

24:01 But one thing that is pretty cool is you don't have to be totally accurate there to make it

24:07 work.

24:07 Right.

24:07 You can just do a get commit and you don't just like add stuff and fake stage things and

24:13 then like commit them.

24:14 You just type like get commit, get commit, get branch.

24:17 And it kind of just shows like there's sort of a shorthand.

24:19 Like if you kind of got the sense of it, it'll do the stuff to let you, you don't have to know

24:24 your get perfectly.

24:25 Yeah.

24:25 And the commands that involve, cause you kind of want to play with this stuff to try to get

24:30 it, get your head around it.

24:31 But you don't really want to muck up your own repo or your code base.

24:35 The ones that involve like a, the origin remote repository, like fetch, pull and push.

24:40 Those are great to be, you visualize both of them at the same time.

24:44 And if there's two pictures going on and this is definitely something, a desktop sort of thing.

24:49 I don't think that it would, I think it would be tricky to do this on an iPhone or something

24:54 like that.

24:55 But yeah.

24:55 Yeah.

24:55 Without a keyboard.

24:56 Yeah.

24:56 For sure.

24:57 I'm going to definitely going to bring this to my team and say, Hey everybody, check this

25:00 out.

25:01 Yeah.

25:01 You should do things like, I want you to build a picture that looks like this.

25:05 What get commands and what order of the commands are necessary to result in this structure.

25:11 Right.

25:12 I think that would be a cool way to do it.

25:13 Oh man.

25:14 Okay.

25:15 So, so the second part of the interview, I will fail at also, man, you're tough.

25:22 I'm glad I'm not interviewing with you.

25:24 Oh my gosh.

25:24 Yeah.

25:25 No, I think that would be cool though.

25:27 Cause you're like, all right, well, cause I think conceptually we also have this idea of

25:31 like, I, this is the picture I want, but what are the commands that like take those steps?

25:36 Right.

25:36 Yeah.

25:36 I'm still getting over the, yeah.

25:39 Quick, the integer four.

25:40 How many bytes?

25:42 How many bytes in Python?

25:44 Four or eight or something.

25:45 28.

25:46 Yeah, exactly.

25:47 28 is not what you would expect, but in Python it's 28.

25:50 Yeah.

25:50 Okay.

25:51 And if you want to test, import sys, get object size, pass the number four.

25:55 All right.

25:56 But if here's the, here's the next question, Brian, if I have a hundred fours in a

26:01 Python program, how many bytes does it take?

26:03 28.

26:04 Yeah, exactly.

26:04 Plus the pointers that point at them, but yeah, 28.

26:07 That's pretty cool.

26:08 So 128, I don't know.

26:10 Eight times, 828.

26:13 I don't know.

26:14 How big are the pointers?

26:15 I think they're 64 bits.

26:16 So they gotta be eight.

26:17 I don't know.

26:18 We've gone down a hole though.

26:20 We don't need to.

26:20 What I would rather talk about is, MicroPython.

26:24 Yeah.

26:24 So this is.

26:25 Round out the extras.

26:26 Oh yeah.

26:26 We're in the extras.

26:27 Now a micro bit announced that it's going to come out with a new version in November.

26:31 It's got a whole bunch of videos showing the cool stuff.

26:34 They're shooting at the same price point they had before, which I have no idea what it was,

26:38 but reasonable.

26:39 But micro bit now has a speaker and a microphone.

26:42 So you can play sounds and, and do things like, I don't know, record your voice or something.

26:48 I don't know what you want to do, but, but that's neat.

26:51 Nice.

26:51 Mike.

26:51 Yeah.

26:52 It does do a MicroPython.

26:54 I think that, I think that do something else also, but why would you do something else?

26:57 Use MicroPython.

26:58 Yeah, exactly.

26:59 Yeah.

27:00 I'm looking for the price.

27:01 all right.

27:03 Too much math.

27:04 I think it's $21, but that's Australian.

27:07 So I don't know.

27:08 Something like that.

27:08 It's not a lot.

27:09 Australian.

27:11 Well, the first thing I pulled up was $2,119 Australia, but that's for a hundred packs.

27:17 So.

27:17 Okay.

27:18 All right, cool.

27:20 Now that's really neat that the sound is coming in and you can interact with it.

27:24 I think there'll be a lot of neat stuff you can do there.

27:25 I, that's a really nice, I mean, so far, a lot of these little devices, like how do you

27:29 interact with it?

27:30 Well, you can kind of shake it or you can touch this button or it like has an led and sound

27:35 is a whole nother level, right?

27:36 You could do speech recognition.

27:37 You could play like, I think it's really neat.

27:39 Yeah.

27:40 It looks like they've got some plans to extend what this can do in the future too.

27:44 So it was pretty cool.

27:45 Yeah.

27:45 Absolutely.

27:46 I'm a fan of the circuit playground express.

27:48 That's really fun thing to play with, but this is neat also.

27:51 Yeah, for sure.

27:51 All right.

27:52 I got two quick things to share with people.

27:54 One really fast one yesterday.

27:57 So eight days ago in real time, I was on the four 25 show, which is a Microsoft identity,

28:06 which stream spent three hours converting a flask web app to use federated identity and like

28:15 remote login and all sorts of cool stuff like that.

28:17 And like just to step away from also having like social logins and whatnot using all those

28:23 libraries.

28:23 So if people are interested in that, I'll link to the whole show.

28:26 And I just want to comment.

28:27 It's kind of, it's a very different way of presenting.

28:30 Like I'm used to polished presentations.

28:32 Like what are we going to do in this half hour?

28:34 Let's get it all down really clear.

28:36 Here's the demo I'm going to write.

28:37 I've already like gone through it once.

28:39 So I know it's going to work.

28:39 And this is like, Hey, we have this idea.

28:41 Let's just work on it until we get it done.

28:43 And just kind of like take input from the audience, from the people watching live.

28:48 And yeah, for people who've done presentations and haven't done this style, it's, it's an interesting

28:54 shift.

28:55 It's a cool way to like sort of present programming to people.

28:57 I think.

28:58 So would you do it again?

28:59 Did it, was it fun?

29:00 Yeah, it was fun.

29:00 It was a little stressful because I haven't done a lot with like, you know, like OAuth identity

29:06 type stuff.

29:06 So I'm like, I have no idea if we're going to be successful, like making this work at all.

29:10 But it was fun.

29:11 And you know, spoiler alert, it worked in the end.

29:13 Is the 425 a joke on like, you know, five minutes after 420 or?

29:17 Yeah, that's, I have no idea.

29:20 No idea why.

29:21 Okay.

29:21 There's an about, let me see if it says what it says in the about.

29:24 I have no idea.

29:26 It doesn't say.

29:26 Okay.

29:27 But anyway, it was, it was fun.

29:29 So people can check out that video.

29:31 And then also I've started using something interesting that people may find interesting.

29:35 So one of the things that bugs me is so much of our life is on the web, right?

29:40 As you know.

29:41 And how many cookies do you think your browser has in it?

29:44 If you would like to sum them up across all the sites.

29:47 No.

29:48 Like an untold number, right?

29:49 Like 100,000, 200,000, like some insane number.

29:52 If it had been, you know, the same browser for years and you've used it all day, like who

29:58 knows, right?

29:58 Yeah.

29:59 So I had a couple of thoughts.

30:01 I decided, well, I want to just restart all that from scratch.

30:04 So I erased every bit of history from my browser and fired it back up.

30:09 I'm like, okay, now I've got to log into all these things again, which is fine.

30:12 But then also realize like, do I want, like say, if I go to some random site and maybe it

30:21 has some cross site vulnerability or whatever, do I want that site potentially to be able

30:24 to say to get to my GitHub things or my bank or whatever, if I'm logged in.

30:29 So I started using this thing called Firefox containers that let you basically create like

30:34 isolated independent browsers for like categories of sites.

30:38 So like, oh, like GitHub and all the, and Bitbucket and all those things are in their

30:42 own like container.

30:44 So only cookies they ever see in login sessions and whatnot are between say GitHub and Bitbucket

30:50 like those and all the other browsing, none of them know anything about that I've ever visited

30:56 GitHub, for example.

30:57 Oh, cool.

30:58 So anyway, if people are, if that sounds interesting, I'll link to a little, short video.

31:02 Is there a limit?

31:03 I mean, cause you could possibly just do a container for each site that you go to.

31:07 You could, it gets a little bit annoying because if you click on, like if you're in like Google

31:12 drive and you click on a link and it takes you somewhere and you did that like over, over

31:19 grouping it, like you'd have to log in every time cause it wouldn't know it.

31:22 There's a little bit of a juggling.

31:24 So too many is, it gets annoying, but yeah.

31:27 Anyway, it's kind of a cool idea to like keep all those things separated.

31:30 People definitely should put Facebook in there cause.

31:32 Oh yeah.

31:32 I have, I have one specifically the container, like the containers are like banking, shopping,

31:38 code, cloud drives.

31:40 And I have one called shunned and shunned is where Facebook is.

31:43 Yeah.

31:46 So for example, that's a great example.

31:47 So like you go to all these sites and they have like Facebook pixels and all this tracking

31:50 stuff.

31:51 Like, because I put Facebook over there and didn't log into it anywhere else, then it

31:56 will never, those things will never trigger for me in the sense of like being tied to my

32:00 account.

32:01 Right.

32:01 Yeah.

32:02 And that makes me happy.

32:03 I've got like one relative that's that the only way to get ahold of them is through

32:06 Facebook messenger.

32:07 And so I have to have Facebook just for that.

32:10 Yeah.

32:11 So you got to get one of these and like you kind of sort of don't have it.

32:14 Awesome.

32:16 All right.

32:17 Well, that was funny, but not nearly as funny as what we got coming up here.

32:21 Okay.

32:22 All right.

32:22 You want to do the first one?

32:23 I'll do the next one.

32:24 And then you've got to do the last one.

32:25 Cause I don't know where we're going with it.

32:27 Okay.

32:27 So I'm doing the first one.

32:28 Yeah.

32:29 Okay.

32:29 Where did developers drink?

32:31 I don't know.

32:31 Where do they drink?

32:32 At the food bar.

32:33 I had that food bar.

32:34 I love it.

32:35 Yeah.

32:35 All right.

32:35 This one, you got to do the last line for me.

32:38 Okay.

32:38 Cause it's a knock, knock joke where normally it's like knock, knock.

32:40 Who's there?

32:41 How?

32:41 Which cow?

32:42 Interrupting cow.

32:43 That kind of thing.

32:43 Right.

32:44 Yeah.

32:44 All right.

32:44 Knock, knock.

32:45 Async function.

32:46 Who's there?

32:47 Perfect.

32:50 All right.

32:51 So those are the two jokes.

32:52 What's this last one?

32:53 Oh, also, if anybody tells us that we've already done this async knock, knock joke before,

32:58 we haven't.

32:59 This is the first time we just, they somehow, asynced.

33:03 That's right.

33:04 Exactly.

33:04 Yeah.

33:05 Yeah.

33:05 It's just, it's a race condition.

33:06 It's not a, not a problem.

33:08 Fine.

33:08 Yeah.

33:08 No, I just, something funny happened to me on Twitter the other day.

33:12 Somebody contacted me and said, Hey Brian, what testing module would you recommend?

33:17 I'm aware that there's unit test and pitest, but are there better options?

33:22 Can you, can you guess which one I recommended?

33:25 Well, you don't like to install stuff.

33:28 So you definitely said unit tests.

33:29 Yeah.

33:32 That's right.

33:33 Yeah.

33:33 That's funny.

33:34 Awesome.

33:34 Cool.

33:34 Cool.

33:35 I thought it was a joke at first.

33:36 I really thought they were joking.

33:38 They were pulling your leg.

33:38 They're like, let's see what you'll say.

33:40 Come on.

33:40 Of course you'll say pitest.

33:41 Yeah.

33:42 But apparently he knew of me somehow without knowing that I wrote the book.

33:46 So yeah, exactly.

33:47 Yeah.

33:48 Cool.

33:49 Cool.

33:49 Well, thank you as always.

33:50 Thank you.

33:51 Yep.

33:51 Bye.

33:52 Next time.

33:52 Yeah.

33:53 See you next time.

33:53 Thank you for listening to Python bytes.

33:55 Follow the show on Twitter via at Python bytes.

33:58 That's Python bytes as in B Y T E S and get the full show notes at Python bytes.

34:03 Dot.

34:03 F M.

34:04 If you have a news item you want featured, just visit Python bytes.

34:07 Dot.

34:07 F M and send it our way.

34:08 We're always on the lookout for sharing something cool.

34:11 On behalf of myself and Brian Okken, this is Michael Kennedy.

34:14 Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page