Transcript #19: Put your Python dictionaries in a box and apparently Python is really wanted
Return to episode page view on github00:00 Hello and welcome to Python Bytes.
00:02 This is episode 19, where we're going to deliver Python news and headlines directly to your earbuds.
00:09 It's recorded on Sunday, March 26, 2017.
00:14 I'm Michael Kennedy.
00:15 And I'm Brian Okken.
00:16 And we got some Python news for you.
00:18 Hey, Brian, how's it going?
00:19 It's going really good.
00:20 Yeah.
00:21 I'm excited about what you picked out.
00:22 I want to learn about the ones that you got.
00:24 And I have some sort of outer loop ones that are really, really different.
00:28 but I think people will be interested to hear about them.
00:31 But let's start with what you got on tap.
00:33 - Well, we're gonna start with a story about exceptions in Python 3, not exceptions in Python 3, but there is a person named Josh or Quicks on GitHub who wrote a little utility for Python, which is actually really cool and it's called Better Exceptions.
00:53 And it's a hook that actually is pretty clever, but it hooks into your exceptions.
01:00 And so when you're like, especially when you're developing and debugging or dogfooding your own products, it will show exceptions that are color coded and split out everything that's in there.
01:13 And we have the link on their show notes, but there's a great picture that you can see that shows the exceptions as they--
01:20 - Yeah, what I like about this is that, like you said, a picture is what you have there.
01:25 And we talked about Peter too, last week about making that sort of bland, just flat list into like something really readable and colorized and nice.
01:33 And this kind of does that for exceptions, right?
01:35 - Yeah, it does.
01:36 And it was really great.
01:37 And Josh works, he mentions, and then he posted it on Reddit as well.
01:43 And on Reddit, he mentions that he works only in Python 2.7.
01:48 So he wasn't sure how to do Python 3 at first.
01:52 And he put this together pretty quickly and then put it out there for everybody.
01:55 And immediately the conversation on Reddit turned to Python 3 and why isn't there Python 3 support?
02:03 And one of the great things about this story is Florian, who is Paradox0 on both GitHub and on Reddit, said instead of adding to the complaints list, he went out and made it, he forked it.
02:18 in a pull request with a Python 3 fix and within like eight hours the whole thing was merged and it was Python 3 as well. Yeah so like eight hours of the thing being announced it came out without Python 3 support. The community went in and added Python 3 support. It's something like this right?
02:36 Yeah and it's just really incredible and I actually reached out to both of them and wanted to know if they had anything to add to the story and like I was saying Josh wasn't he didn't know how to do make sure that it was running on both because he normally works on Python 2. And Florian, apparently he supports this tool called WDB, which is a web debugger, which actually we should explore a little bit later. It's pretty cool. Anyway, he's used to doing that two and three all the time. So it wasn't that big of a jump for him to add that support, which is great. So I like it. Yeah, I think it's cool. I think better exceptions, the package is really cool. And I And I think the Python 3 story of 8 hours from the time it was published, somebody went and said, "There's a problem with this.
03:21 It doesn't support Python.
03:22 It only supports legacy Python.
03:23 We have to fix it." That's really cool.
03:25 I'm not sure if that would have happened four years ago, right?
03:29 Right.
03:30 And it's really great.
03:31 The other thing, when I tried this out, and one of the things that I noticed about it is you have to put an import statement in the modules that you want to use this better exceptions.
03:43 also thought maybe we should modify that.
03:47 So he added another GitHub project called Better Exceptions Hook that if you include that as well, you don't have to do that import statement.
03:56 - Oh, nice.
03:57 - It's pretty great.
03:58 - Yeah, that's really great.
03:59 Cool, so everyone check out Better Exceptions.
04:01 Check out the Reddit thread.
04:02 We'll link to that, of course, maybe as the primary thing and all the stuff's in the show notes.
04:06 Very cool.
04:06 One of the things I always look forward to, Brian, is the Stack Overflow Developer Survey.
04:12 Stack Overflow is such a powerhouse in the software space, and they get quite a bit of feedback on their surveys, you know, like 100,000 people filling out the survey or something, and it's really comprehensive.
04:26 So this year, they just released a couple days ago, the 2017 survey, and it has good news for Python in there.
04:35 - Really, and it looks like they get results from all over the world.
04:38 - They do, yeah, they get a ton of results, like I said.
04:41 They have stuff on gender equity, pay across different regions, job demand, all sorts of stuff like that.
04:48 But the most interesting thing to me is really around the programming languages that are being used or desire behind working with certain technologies and so on.
05:00 So there's some good news here for Python.
05:02 If you look at the most popular technologies, we talked recently about Python being the the second most popular technology behind JavaScript on GitHub on Stack Overflow in terms of questions, it's number five.
05:16 And given that it's pretty easy to work with relative to things like Java, which might generate more questions, you know, I think that's pretty interesting.
05:24 So that's cool, but let's go down a little bit farther.
05:26 They have areas where they talk about the frameworks you're working with, the databases that people are using, platforms, but one of the things that caught my attention is languages over time.
05:39 So we've got things like C#, JavaScript, Objective-C, Node.js, and whatever, Java itself.
05:47 If you look at Python over the last, what is that, five years?
05:52 It went from 22% to 33%, and it's got like a hockey stick-like curve going to it.
05:58 So it's not just it's going up.
06:00 It's going up, and the rate is increasing.
06:02 How cool is that?
06:03 That is very neat.
06:04 I like it.
06:04 If you compare it to Java, Java's on a pretty downward trend.
06:07 C# is on a downward trend.
06:10 C++, downward trend.
06:11 So that's cool.
06:13 One other one that really I like, there's a section called Most Loved, Most Dreaded, and Most Wanted.
06:20 So Python ranks very highly in the most loved.
06:24 And just let's see how the story is for most dreaded.
06:27 It turns out Visual Basic 6, VBA, CoffeeScript, and VB.net, three out of four for Visual Basic are in the most dreaded technologies, just with MATLAB, Tel and along.
06:39 But if you go over to most wanted technology, Python by a wide margin.
06:43 - Wow.
06:44 - Out of everything.
06:45 - That's great.
06:46 - Over JavaScript, over Go, over TypeScript, over Swift, over Rust, whatever.
06:51 It's 20% of the people said, "That's the thing I want most." Who responded about that?
06:56 Isn't that cool?
06:57 - What does most wanted mean?
06:58 - It means what, if you could choose, They ask, what are you using for your day-to-day job?
07:04 And they ask, if you could use anything, what would you use?
07:07 - Oh, okay. - Yeah?
07:09 Just to round it out, one more thing, since I've been going on and on about Mongo and stuff like that recently, if you go to the database section and look at the most wanted database, MongoDB is like more than 2x over second place.
07:22 So also quite interesting.
07:24 - Well, working with document databases is just, I like it, if you can do it.
07:29 - It's so glorious, yeah.
07:30 If you can make it work, it is so, so nice.
07:32 We'll have to cover that in more detail.
07:34 But I strongly encourage you guys to go and have a look at this survey.
07:37 It's always really insightful.
07:39 They had 64,000 developers in this response.
07:42 It's not 100,000, sorry.
07:44 But still a huge number to make this highly statistically relevant, right?
07:48 - Yeah, and we need to get more.
07:49 It looks like there's still, with surveys like this, we still have more white dudes answering than other people.
07:56 - Yeah, that is an ongoing problem.
07:59 But what was it there?
08:00 Okay, so since you brought that up, I was thinking about, didn't wanna go on too long, but there's a section in here that talks about, near the beginning, it talks about demographics, and it says males like 88.6%, females 7.6, white dudes are like 74%, if you throw in Asians, it's super, super near like the top.
08:25 But there's also a section somewhere in there that talks about years of coding experience and demographics over time.
08:32 And they break that down, they don't break it down by anything but male, female, I don't think.
08:36 But if you look at less than one year experience, there's more women than men.
08:41 If you look at one to two, there's more women than men.
08:43 It's not until you get into five years of experience that there are more men.
08:48 And then it's just after that, it's gone, right?
08:51 It's all men all the time.
08:52 But that's pretty encouraging to me because that means people coming into the industry, there's a lot of women coming in actually.
09:00 - Yeah, that is really encouraging.
09:02 That's good.
09:03 - So it's right that it is kind of bleak in that sense, but there's a bit of a shining, at least a positive data point there.
09:10 I think that's great.
09:11 What do you got next for us?
09:11 - Next, I've got a project called Box, and there was an article on Code Calamity.
09:18 That's a cool name.
09:19 Anyway-- - That is a cool name.
09:20 - This is a really pretty simple tool, But you just take a dictionary and throw it into an object class called box.
09:28 And what it does is it makes it so that you can use dot notation instead of that annoying--
09:34 I mean, the dictionary notation is OK.
09:36 It's like so many characters to type, and the brackets and the quotes.
09:41 And for single word elements in your indexes in your dictionary, Box makes it so you can just use dot notation instead.
09:50 It's pretty cool.
09:52 That is cool.
09:52 I am so using box.
09:54 So what's really nice about it, it feels like it's a little bit similar to like name tuple type things.
10:00 I guess it's dictionaries rather than names for the tuples.
10:03 But still, it's like, kind of like that, like you take this thing you have to index into and you turn it into a thing you can use dot names on.
10:12 And while that's pretty helpful, what I think is really cool looking, this is you can have like a deep object graph.
10:18 So in their example, they have a box which has movies, the movies, one of the movies the spaceballs, the move, each individual movie has a rating.
10:25 And you can just say my box dot movies dot spaceballs dot rating.
10:28 And so if that was dictionaries, that would be a lot of this dot, get this, dot, get this, dot, get this or bracket, bracket, bracket, bracket.
10:35 Right.
10:35 Yeah.
10:35 If you're trying to test each one of those, then that's even, even less fun to test that it's in the, in the dictionary.
10:41 Yeah.
10:41 And it doesn't like, obviously I was trying to train it out.
10:44 Like one of the movies was that they showed in their demo was Robin Hood, men in tights, also good movie.
10:50 Anyway, it has spaces in it.
10:53 So obviously you can't make a dot name thing with something with spaces in it.
10:58 So it just punts and doesn't do it for those.
11:01 So it's only--
11:02 - Right, okay.
11:03 Yeah, so those you have to basically use the brackets, treat it like a dictionary.
11:07 - Yeah, but it's enough.
11:09 Anything that saves me a little bit of typing and makes my code look a little cleaner, I'm gonna give it a try.
11:14 - Yeah, this is cool.
11:15 I think the thing that's awesome about this is it makes your code more readable.
11:18 - Yeah, definitely.
11:19 Okay, cool. Well, thanks for teaching me about Box.
11:22 So it wasn't very long ago that we just talked about Python 3.6 being released, right?
11:26 Yeah, very exciting.
11:27 Yeah, it's super exciting. That's a big release.
11:29 There was a lot of performance improvements, both in memory and CPU time.
11:33 And so we are already at our next release.
11:37 So on March 21st, we had Python 3.6.1 released. How about that?
11:41 That's pretty cool. I haven't tried it out yet, though.
11:44 I'm running it. It's been working well for me. It's very nice.
11:46 there are actually a surprising number of changes given the time frame between 361 and 360 being released. So there's a lot of there's a lot of fixes. There's there's probably 25 fixes and optimizations for core built-in. If you look at the the library there's probably 35 to 40 fixes. Things like there was a some kind of bug in arg pars that help messages would wrap on non-breaking spaces and other funky stuff like that fixes to the magic mock library.
12:18 So what struck me about this release is like a 361 release feels like you got 360, 361, whatever, it's all the same, right?
12:26 But there's actually a non trivial number of things that I might actually want to go and say, Oh my gosh, we need to upgrade to this.
12:33 So for example, another one is fixes a crash when deallocating deep element tree objects.
12:39 So if you load up large XML files and are having problems with that, maybe you want to look at this.
12:45 There's also sections on Windows, on the C API, and lots of stuff.
12:49 The other thing that's interesting or notable about this is, I don't know if 360 or 361, but one of those two recent releases is the first time that Python is shipping off of GitHub since it's moved off of Mercurial.
13:02 So that's pretty cool.
13:03 I think so, anyway.
13:04 I think so.
13:05 I'm pretty sure that 3.5 was on the other one.
13:08 I can't find which one it is in here, but some of the core developers seem to be very excited about f-strings now with the 361.
13:18 So there must have been some issue with it that we just don't even know about that now makes it work better or something.
13:25 Yeah, the only one I can find is F string expressions are no longer accepted as doc strings.
13:31 You know, that might be it.
13:33 Maybe somehow the f-strings in doc strings were being interpreted when they were supposed to be documentation, like here's the F string to use, I don't know.
13:40 It's great.
13:41 If you get a chance, upgrade to 361.
13:42 I will.
13:43 Well, last, I've got a, I've got to tell us a little bit of a story.
13:47 I went to the University of Oregon and I tried to take statistics in a building called Dee Dee Hall.
13:55 And Dee Dee Hall was built in the 1873 to 1876.
13:59 So it's a really old building.
14:01 And I think my professor may have been born at the same time because he was a really old guy.
14:07 And it was like on maybe the third floor, I had to walk upstairs, little tiny room, and four o'clock in the afternoon with air conditioners blowing.
14:18 And the gist of it is, is I didn't learn statistics.
14:21 I slept through that class.
14:24 And so I'm excited that there's an article called, and it looks like it's a start of it, it's called Essential Statistics for Data Science.
14:33 So it's teaching some of the Python data science stuff along with and how to use statistics with it, but also teaching you about the statistics while it's going.
14:44 And I really appreciated that, and it was really easy to follow even for somebody that slept through statistics.
14:51 - You know, data science is actually one of the reasons, I think, for that growth in the Stack Overflow section.
14:57 I was talking about others as well, right?
14:59 But I think the addition of all these data scientists moving into the space makes such a big difference.
15:05 So there's a lot of people coming into the space and really having a good statistical foundation I think is super important here.
15:11 - In this article, this tutorial, is it also explains the box and whisker diagrams and what all of those pieces mean, which I had no idea what those meant before, so thank you.
15:24 - Okay, yeah, yeah, that's awesome.
15:26 - Anyway, that's all I got.
15:27 - Yeah, okay, well the last one that I wanna talk about is called Hi, H-Y.
15:32 And for those of you out there that like Lisp, this will be music to your ears.
15:39 So the idea is Hi is a Lisp environment, Scheme Lisp type thing, and you can take it, give it Lisp code, and it will actually take that code and compile it or assemble it into Python abstract syntax trees and then just hand it off to Python to execute.
15:59 So we've talked about all sorts of different runtimes or interpreters.
16:04 We have the two CPython versions.
16:07 We have PyPy.
16:08 We have Python.net.
16:10 We have Jython.
16:11 We have IronPython.
16:12 We've got Cython.
16:14 There's lots of different choices you can make, but I've never talked about Hi.
16:18 And this was actually a listener recommendation.
16:20 So thanks for sending that in, guys.
16:22 So this is if you write Lisp code, you can write code in Lisp, and then it just runs on top of Python, which is cool because it means that you basically get access to the entire standard library and all the PyPI packages for your Lisp programs, which I think is pretty awesome.
16:40 So if you want to work with various libraries, requests, it says you can write Django applications in Lisp, if that seems like a good idea to you, you can use Hyda to do that.
16:50 Probably Flask and Pyramid as well, I guess, because you just import it, right?
16:54 So yeah, they think it's a great way for people to explore Lisp if you are comfortable with Python.
17:00 Now do something for me, click on the link that says you must try, try-hi.appspot.com and just tell me what you think when you see that.
17:09 That's cool, right?
17:10 So you guys all check this out when you hear this, click this link in the show notes.
17:14 What version of Apple is that?
17:15 It's not even Apple, but it looks a little bit like an Apple IIe computer.
17:19 Oh, that's so cool.
17:21 It's a little tiny old CRT and you can type on, like when you type in, you get to type right on this little monitor.
17:29 It's cool.
17:30 - It's fantastic.
17:31 It's even at an angle and you get to type into the interpreter and it's live and you can try out Lisp.
17:36 My Lisp is not good enough, but I can at least hit enter and see 42L come out.
17:39 So check this out.
17:41 This is really pretty interesting if you're into Lisp.
17:44 If you're not into Lisp, I think it's just an interesting data point of here's one more thing, one alternate way to get other languages in the Python ecosystem.
17:53 Yeah, I just tried out the extent of my Lisp knowledge that cons makes a tuple.
17:58 So nice. I have forgotten all about the cutter in the car and all that stuff from when I took it back in school. It's been a long time. It's been a long time.
18:05 It is. All right. Well, that's it for the news this week, everyone. I think Brian, you found some good ones.
18:12 Thank you. I do want one last thing I want to do a little bit of follow up last week when we covered Peter too, I commented that it didn't look that great in PyPI.
18:22 And that was fixed last week.
18:25 And with one of the best pull requests I've ever seen or comments in the code, and it was, the comment was remove beer from readme.
18:33 Apparently there was a beer Unicode symbol that was messing up the PyPI stuff.
18:39 So that's good.
18:41 It's marked as a bug and urgent that we get the beer out of the readme.
18:45 Fantastic.
18:46 That is awesome.
18:48 All right, yeah, cool.
18:50 So, it's pretty neat that that actually, that people listen to our show and change the projects based on it, right? That's awesome.
18:56 Yeah, or they may have noticed it on their own, but let's go with that they're listeners. They took your advice and removed the beer. Excellent.
19:04 All right, well, thanks so much for chatting with me, Brian, and sharing the news with everyone. It's fun as always. Thank you. Yep. Bye.
19:10 Thank you for listening to Python Bytes.
19:14 Follow the show on Twitter via @pythonbytes, that's Python Bytes as in B-Y-T-E-S.
19:19 And get the full show notes at pythonbytes.fm.
19:23 If you have a news item you want featured, just visit pythonbytes.fm and send it our way.
19:27 We're always on the lookout for sharing something cool.
19:30 On behalf of myself and Brian Okken, this is Michael Kennedy.
19:33 Thank you for listening and sharing this podcast with your friends and colleagues.