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 to your earbuds.

00:04 This is episode 205 recorded October 21st.

00:08 I'm Michael Kennedy.

00:09 And I'm Brian Okken.

00:10 And this episode is brought to you by us.

00:13 More about that later, how you can support what we're doing.

00:16 Right now, Brian, I'm really sorry, man, but I've got something a little bit awkward to talk about.

00:20 Well, this is awkward.

00:22 I know, but luckily it's just you and me, so you don't mind if I just sort of tell it to you straight?

00:26 Yeah, just tell me.

00:27 All right.

00:28 Well, sometimes I have an array and it's perfectly tabular.

00:32 Like it's, it's maybe just a linear array or sometimes the array goes across.

00:36 Like every entry is like 20.

00:39 It's like a list with like 20 length, 20 lists in it.

00:41 And it's all the right size, but sometimes, 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 things.

00:56 And so if you've got data that's kind of like an array, multi-dimensional array, but it doesn't fit that shape, what do you do?

01:02 Well, Simon Thor sent us a message and said, "You all should talk about awkward arrays." So awkward arrays, this is a, it's actually a pretty advanced library.

01:14 So it's a little bit like NumPy, and it has NumPy-like idioms and so on, but it's a library for nested variable size data, including arbitrary length lists, records, mixed data types, missing data, and all those things, and dealing with those with NumPy-like idioms.

01:32 So it's better for handling, you know, like what I described, not the same shaped data.

01:39 It's kind of the same dimensions, but it's not always the same length on the various parts.

01:44 And you could even use it with things like Numba to JIT compile the code to make it even faster.

01:50 And they just announced version 1.0 of this library, which was originally written in Python.

01:56 So it was good, but not super, super fast.

01:59 And they rewrote the core in C++.

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

02:09 So it's super fast.

02:10 - Nice. - Yeah, pretty cool.

02:11 And what do you think about the logo?

02:12 - The logo is actually great.

02:14 It's awkward array, but the second array is below awkward.

02:19 and the A is capitalized so it sort of runs into the K and the W and the F to squish out of the way.

02:25 It's very clever.

02:26 Yeah, kind of bent and awkward looking.

02:28 It's pretty clever. I like it as well.

02:30 Another thing that I thought was interesting, if you open up the link over there, you don't have to, but if you were to go there, like right on the page it says here's the Python quick start.

02:38 Oh, and here's the C++ quick start.

02:40 So this library, the internals of it are written in C++, right?

02:45 Okay.

02:45 So that it's fast 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 library that does data science-y things, and you have a big C++ C component aspect of it, you could use the C side of it directly there.

03:05 - Nice. - Yeah.

03:06 So that's actually something I don't see almost ever is, here's the Python library and the C++ API that corresponds to it.

03:13 - Yeah, that's pretty cool. - Yeah.

03:14 Also, it's I have a lot of cases for this. I'm gonna definitely check this out. Mm-hmm. Yeah, it's pretty cool So thank you Simon for sending that in Last quick note is when you install it you pip install awkward the number one not just awkward I think awkward which my gosh It's just so weird to have a package called awkward, but it's great. Anyway I think awkward is the older version and awkward one is this new 1.0 release. I think it's the same library I wasn't sure if like, I was like, okay, if this is awkward one, what is just awkward by itself?

03:48 That's got to even be more awkward But I think it's the same library. It's just a different api version. Okay, okay You might be surprised by it. But nonetheless, it's it's pretty good library. Go and check it out. Yeah, you got any surprises for us Yeah, the surprises came from ned batch elder. So, Ned surprised us with um some surprising order dict ordered dict surprises So I think we've covered this but in python 3.6 Dictionaries change a little bit so normal dictionary just use a dictator just declare one they retain their insertion order.

04:20 If you list them out again or just you know say.

04:24 You know if you have x equals some dictionary and print x on the rebel it'll just print it in the same order it arrived in right and if you do like for k comma v.

04:35 in dictionary.items you'll get them in the same order now which is nice.

04:40 I think probably one of the most annoying things was if you are saving a dictionary, if you're going back and forth between a JSON file into a dictionary and then you save it again, right, like, that could just randomly be changing before whereas you'll be getting like diffs on that file. Anyway, 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 still a collections.ordered dict that is around.

05:08 It's still around and there's a few reasons for it. One of them is just because it's a class that some other stuff derives from and it would break backwards compatibility to remove it.

05:18 So I'm glad it's still there.

05:20 But Ned brings up a couple surprising things around it.

05:23 The first actually wasn't that surprising to me.

05:26 They're ordered, but you can't get access them by order.

05:29 You can't say, "Give me the first one," by saying bracket zero or something.

05:34 Does this surprise you?

05:35 Doesn't really surprise me.

05:36 Not really.

05:37 I would just do--

05:39 I mean, it's a dictionary.

05:41 Yeah, just get the first thing out of items, and then just be happy with that.

05:45 I don't know.

05:45 But yeah, there's no way to index bracket zero of the dictionary.

05:49 Right.

05:49 That's OK.

05:50 The thing that actually I didn't really think about before was that Ned brings up is that how equality and order mix.

05:57 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're created in a different order, they're still going to be equal.

06:12 So two dictionaries are equal if they have equal contents.

06:14 It would super bug me.

06:16 Like if I have A equals one, B equals two, or B equals two, A equals one.

06:20 If the dictionary contents are the same, but the order changes, and 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.

06:31 So 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.

06:44 Surprise!

06:45 - Surprise!

06:46 - Or maybe not, but thanks, Ned.

06:47 - Yeah, that's cool.

06:48 I wouldn't have known that.

06:49 That's pretty neat.

06:50 Speaking of knowing stuff, you and I work on a few things.

06:52 So we've got some Patreon stuff going on, a lot of ways people can support us.

06:55 I'll just really quick shout out, as a lot of people know, if you want to get better at Python, learn some things, check out training.talkpython.fm.

07:04 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.

07:13 We now have 55 supporters on Patreon, which is super cool.

07:17 And if you go to any of our show notes, there's a Patreon link on the side, you can click on it.

07:22 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. - Thank you.

07:28 - Yeah, it definitely helps out.

07:29 It covers operating expenses like editing and transcripts and whatnot.

07:33 - Yeah, so what you got next for us?

07:36 - I have a follow-on to a follow-on to a follow-on.

07:41 How about that? - 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 format it.

07:51 And a bunch of people said, "Oh, and there's this, "and there's that, and there's all these great things." And you covered, I think it was NB--

07:58 - NBQA. - QA, yeah, was it?

08:00 Yeah, it was 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:09 But one of the things that bugs me about Jupyter Notebooks is they just seem to lack some of this 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:25 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:37 Like there's no help.

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

08:40 And then when I type it out, I say parentheses, 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:51 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:59 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, okay, type and then okay, now what's the documentation again for the signature?

09:12 Where is it defined?

09:13 All those kinds of things.

09:14 So there's this cool project that was sent in by Anders Kallmer called JupyterLab LSP for Language Server Protocol Integration or more accurately, it rolls right off the tongue.

09:30 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:42 So if you go there, you'll see that there's a bunch of examples, sample code, which shows Python, but actually works in R, Bash, TypeScript, and a bunch of other languages.

09:50 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 a function or class signature.

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

10:07 It'll show you like if you write code that's bad, like in Jupyter, if I write code that's bad it just it looks like code that's good except for it won't run. Whereas here to put little squigglies under it and say there's something wrong with this or there's a warning here you're doing something wrong right so editor stuff like that. Jump to definition so you can right-click and say take me to where this variable or this function is defined which is pretty awesome. It'll highlight your references if you place it on a variable like in PyCharm if you put got a variable you put your cursor on it like all the places where it's used or defined light up.

10:41 So like that.

10:42 Yeah.

10:43 And auto completion.

10:45 If I type the character dot, it will know that I want auto complete.

10:49 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 a rename, rename refactorings.

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

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? Just to bring it a little closer to editors like PyCharm and VS Code. And it proves the point that the hardest thing in computer science is naming. That's right. We have a whole function when you get that wrong. That's what you do. Yeah, but I mean the name Jupyter. Jupyter-JupyterLab-LSP. Yes, indeed. All right, All right, 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:43 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, and it's really cool.

12:02 So what it is, it's an online book powered by JupyterBook.

12:05 The authors are Ethan Manilow, Prem Setherman, 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, and maybe that's a limited set of people, but it's really neat.

12:30 that uses Python and it has interactive demos.

12:33 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, it's beautiful.

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

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

12:51 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:15 - 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:24 I like it.

13:25 - Yeah, yeah, it's super cool.

13:25 And they do have it on, it's open source on GitHub.

13:28 So that's pretty sweet.

13:29 I do have a complaint though.

13:30 Okay.

13:31 This is a big deal.

13:32 So, there's a section in here on the basics of phase, phase and phase train, 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:47 Come on.

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

13:52 It doesn't start with J. It starts with I.

13:55 Sorry, carry on.

13:57 That phase thing is gorgeous.

13:59 - Yeah, the animations in Phase is actually really nice.

14:02 - To tell you the truth, I deal with signals all the time and if you want to get into the math, the math is here.

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

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

14:17 It's still useful.

14:18 - Yeah, quite neat.

14:19 All right, let me ask you a question.

14:21 - Okay.

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

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

14:24 - I do it every day.

14:25 - Yeah, right on.

14:27 Python have pointers.

14:28 - Somewhere, I guess.

14:30 It's gotta be.

14:31 - 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:38 - All of Python seems like a reference.

14:39 - I wanna cover an article, Pass-by-Reference in Python, Background and Best Practices, from the RealPython crew.

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

14:48 So.

14:49 (laughing)

14:50 - By Marius Mogiarossi?

14:53 Hopefully I got that somewhat close.

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

15:02 And it sort of compares languages that have explicit, you can explicitly work with things as references or pointers, or you can work with them as local value types.

15:12 And then sort of compare that, like there are certain types of problems you might solve 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, even the number four.

15:30 If you ask, like the number four in C, if I said four, how many bytes would you think that would take?

15:36 - It depends on, in C?

15:38 - Yeah.

15:39 - It's the machine type, so it's--

15:40 - Right, so probably four or eight, something like that, right?

15:42 - How many bytes, yeah, yeah.

15:43 - Yeah, exactly.

15:44 And when you create one, it would be associated with a stack, unless you did some funky stuff 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 comes on the stack and you pass around and makes a copy of it.

15:58 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, like the number four takes 28 bytes, which is pretty interesting.

16:12 But so everything like even basic numbers that seem like they just might be values are like in the guts, these sort of reference types.

16:19 the function passing behavior is they say it's something called pass by assignment which I'll go with that so when I pass in like if I create a variable say X equals 4 and then I pass the X to a function and that function changes the value of X it's changed for the function but not for the global thing that had it before right yes well in C or C++ or C# like all the examples here actually C# you can say no no pass it so that if you the the function changes the variable, the one where it came from also changes, right?

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

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

17:07 So how do we do that in Python?

17:09 And what are some of the interesting things that you might do?

17:12 Said, well, Python doesn't have value type, so it doesn't, one of the problems with the value type world is like, Maybe if I created a class, let's say a class in C++, and I create it on the stack and I pass it, it's, I think I 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 making copies of the data that's passed around.

17:33 That can make things slow.

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

17:39 So that doesn't apply.

17:41 But how do you implement these algorithms?

17:44 So it says, well, if you wanna actually have the function make a change, you can do a couple of interesting things.

17:50 Like you could, suppose I want to pass in a variable, maybe have that variable change, but also get like a true false back, like it worked or it didn't work or something along those lines.

18:01 So they said, look, you can use tuple unpacking to return multiple values, the return value 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 a field on the object.

18:15 Right? So that would have this or list or yeah, anything that is mutable, basically, or another interesting one would be returning optional value types.

18:25 So if I had like a function that was say, like they would say, okay, we're going to try to parse a string into an integer, and I either want to tell you, here's the number, the integer you got, or it didn't work.

18:36 Forget that you might throw an exception, but suppose for some reason, this example, you don't want to throw an exception, right? What do you do?

18:44 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 tri pars takes a string and an out integer, which is like a one way ref type of thing.

18:58 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 worked and here's the value or it didn't work and there's no value, which is, I don't really love that one.

19:11 One that is interesting is 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, value colon equals, try to parse it.

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

19:26 That one's kind of OK with me.

19:28 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 I was reading through it, it just made me think about--

19:38 Think back to my C++ days and all these patterns of passing variables and changes and, you know, passing by reference, copy and 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, I actually like it to be more explicit and have either do functional programming where you're...

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

20:03 Yeah, exactly.

20:04 The other approach that I like is to know, I mean, you have a shared data that you're pointing to that you, you know, you're past a modifiable data, like, like a list or something and say, hey, this function and it's needs to be obvious, like fill out the data, you know, it's needs to be obvious that the thing you're calling is going to change that, or use a database reference, changeable stuff.

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

20:31 I thought it was interesting to compare these other styles of programming to how you might get them done in Python.

20:37 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 tripars that returns none if it doesn't work.

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

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

20:51 If you've got the return of a value in some nested data or logic, and you don't return anything otherwise, you're going to return none.

21:02 Yeah, you know, when I first started learning Python, that's something that was strange to me is that every function returns a value, 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 I kind of forgot that that's not obvious.

21:20 Yeah, yeah, yeah.

21:21 But that takes some getting used to because all the other languages you say, 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, a lot of interesting ways to think about passing variables and some of the patterns there.

21:35 Yeah, my head hurts.

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

21:41 I apologize again. I think somebody on Twitter sent us this, but I couldn't find the reference this morning. This is a really cool thing. The author is WeiWang, I think, goes by only way on GitHub.

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

21:57 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 explanation.

22:06 But it's a visual, not really, it's like a static thing 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, read something about how Git goes together.

22:20 But this visualizing tool is super cool.

22:23 The one he's put together, it says visualizing Git concepts in D3, and it just nails the things home.

22:30 It's really cool.

22:31 It's got all these different concepts like commit, branch, checkout, checkout with a B, reset, revert, merge, rebase, tag, fetch, pull, push.

22:40 And you just start out with a diagram of what your repo looks like with branches and everything and the dots.

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

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

23:00 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. When I do a checkout, all I'm doing is looking at a different branch and that's it." Yeah, 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 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, 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 going on and then suggest things to try.

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

23:40 You can, you can try it.

23:42 And 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:51 That's not implemented. It's not there.

23:53 But it's pretty cool.

23:55 You know, another thing that's nice about it, 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 work.

24:07 You can just do a get commit.

24:09 commit and you don't just like add stuff and fake stage things and then like commit them.

24:14 You just type like git commit, git commit, git branch, and it kind of just shows like there's sort of a shorthand like if you kind of got the sense of it, it'll do the stuff to let you, you don't have to know your git perfectly. Yeah, and the commands that involve, because you kind of want to play with this stuff to try to get it, get your head around it, but you don't really want to muck up your own repo or your code base. The ones that involve like 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 there's two pictures going on.

24:46 And this is definitely something a desktop sort of thing, I don't think that, I think it would be tricky to do this on an iPhone or something like that.

24:55 Yeah, without a keyboard, yeah, for sure.

24:57 I'm definitely going to bring this to my team and say, "Hey, everybody, check this out." You should do things like, I want you to build a picture that looks like this.

25:05 what git commands and what order the commands are necessary to result in this structure, right?

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

25:13 Oh, man.

25:14 Okay, so the second part of the interview, I will fail at also.

25:18 Man, you're tough.

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

25:23 Oh, my gosh.

25:24 Yeah.

25:25 No, I think that would be cool though, because you're like, all right, well, because I think conceptually, we also have this idea of like, this is the picture I want, but what are the commands that like take those steps, right? Yeah. I'm still getting over the, quick, the integer four, how many bytes, how many bytes in Python? Four or eight or something. Yeah, exactly. 28 is not what you would expect, but in Python it's 28. Yeah. Okay. And if you want to test import this, just get object size past the number four. All right. But if here's the, here's the next question, Brian, If I have a hundred fours in a Python program, how many bytes does it take?

26:03 28.

26:04 Yeah, exactly.

26:05 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:11 8 times, 828, I don't know.

26:14 How big are the pointers?

26:15 I think they're 64 bits, so they got to be 8.

26:17 I don't know.

26:18 We've gone down a hole that we don't need to.

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

26:24 Yeah, so this is...

26:25 Round out the extras.

26:26 Oh yeah, we're in the extras now.

26:27 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, but reasonable.

26:39 But micro bit now has a speaker and a microphone, so you can play sounds 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 that's neat.

26:51 Nice.

26:51 Yeah, it does do MicroPython.

26:54 I think they do something else also, but why would you do something else, use MicroPython?

26:58 - Yeah, exactly.

27:00 Yeah, I'm looking for the price.

27:02 All right, too much math.

27:04 I think it's $21, but that's Australian, so I don't know, something like that.

27:08 It's not a lot.

27:09 - Australian?

27:12 - Well, the first thing I pulled up was $2,119 Australian, but that's for 100 packs, so.

27:17 - Okay.

27:20 - All right, cool, 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:26 That's a really nice, I mean, so far a lot of these little devices, like how do you 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 is a whole nother level, right?

27:36 You could do speech recognition, you could play, like, I think it's really neat.

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

27:44 So this is pretty cool.

27:45 Yeah, absolutely.

27:45 I'm a fan of the Circuit Playground Express.

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

27:51 Yeah, for sure.

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

27:54 One really fast one yesterday, so eight days ago in real time.

27:59 I was on the 425 show, which is a Microsoft identity Twitch stream.

28:08 Spent three hours converting a flask web app to use federated identity and like remote login and all sorts of cool stuff like that, and like just to step away from also having like social logins and whatnot, using all those libraries.

28:23 So people are interested in that.

28:24 I'll link to the whole show.

28:26 And I just want to comment, it's a very different way of presenting.

28:30 I'm used to polished presentations.

28:32 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 gone through it once, 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 take input from the audience, from the people watching live.

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

28:55 It's a cool way to present programming to people, I think.

28:58 - So would you do it again?

28:59 Was it fun?

29:00 - Yeah, it was fun.

29:01 It was a little stressful, 'cause I haven't done a lot with OAuth identity type stuff, so I'm like, I have no idea if we're gonna be successful making this work at all, but it was fun.

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

29:13 - Is the 4.25 a joke on five minutes after 4.20?

29:17 - I have no idea.

29:20 No idea why.

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

29:25 I have no idea, it doesn't say.

29:27 But anyway, it was fun, so people can check out that video.

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

29:36 So one of the things that bugs me is so much of our life is on the web, Brian, as you know.

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

29:45 If you were like to sum them up across all the sites.

29:47 - No way.

29:48 - Like an untold number, right?

29:49 like 100,000, 200, 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 knows, right?

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:13 But then also realize like, do I want, like say, If I go to some random site, and maybe it has some cross-site vulnerability or whatever, do I want that site potentially to be able to say to get to my GitHub things or my bank or whatever, if I'm logged in?

30:30 So I started using this thing called Firefox containers that let you basically create like isolated, independent browsers for like categories of sites.

30:38 So like GitHub and Bitbucket and all those things are in their own like container.

30:45 So only cookies they ever see in login sessions and whatnot are between say GitHub and Bitbucket, like those and all the other browsing, none of them know anything about that I've ever visited GitHub, for example.

30:57 - 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 Drive and you click on a link and it takes you somewhere.

31:17 And you did that like over grouping it, like you'd have to log in every time 'cause it wouldn't know.

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

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

31:27 Anyways, 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, I have one specifically the containers, like the containers are like banking, shopping, code, cloud drives, and I have one called Shund.

31:42 and shunned is where Facebook is.

31:44 (laughing)

31:45 Yeah, 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 stuff.

31:51 Like because I put Facebook over there and didn't log into it anywhere else, then it will never, those things will never trigger for me in the sense of like being tied to my account, right?

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 Facebook Messenger.

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

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

32:14 [laughter]

32:16 Awesome.

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

32:22 Okay.

32:23 All right, you want to do the first one, I'll do the next one, and then you got to do the last one, because I don't know where we're going with it.

32:27 Okay, so I'm doing the first one?

32:28 Yeah.

32:29 Okay.

32:30 Where do developers drink?

32:31 I don't know, where do they drink?

32:32 At the foobar.

32:33 At the foobar, I love it.

32:35 Yeah.

32:36 All right, this one, you got to do the last line for me, okay?

32:38 Okay, because this is a knock-knock joke, where normally it's like, knock-knock, who's there?

32:41 Cow, witch cow, interrupting cow, that kind of thing, right?

32:44 - Yeah. - All right.

32:45 Knock-knock, async function.

32:46 - Who's there?

32:47 (laughing)

32:50 - Perfect, all right, 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, we haven't, this is the first time we just, they somehow asynced.

33:03 - That's right, exactly.

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

33:06 It's not a problem.

33:08 It's fine.

33:09 - 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 pytest, "but are there better options?" (Brian laughs)

33:23 Can you guess which one I recommended?

33:26 - Well, you don't like to install stuff, so you definitely said unit test.

33:30 (Brian laughs)

33:32 - Yeah, I should have. - That's right, yeah.

33:33 That's funny, awesome.

33:34 I thought it was a joke at first. I really thought they were joking.

33:37 They were pulling your leg. They're like, "Let's see what you'll say. Come on. Of course you'll say pytest." Yeah, but apparently he knew of me somehow without knowing that I wrote the book.

33:46 Yeah, exactly.

33:47 Cool.

33:48 Cool. Well, thank you as always.

33:50 Thank you.

33:51 Yep. Bye everyone.

33:52 Talk to you next time.

33:53 Yeah, see you next time.

33:54 Thank you for listening to Python Bytes. Follow the show on Twitter via @PythonBytes.

33:57 That's Python Bytes as in B-Y-T-E-S.

34:00 And get the full show notes at PythonBytes.fm.

34:03 If you have a news item you want featured, just visit PythonBytes.fm and send it our way.

34:09 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