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


Transcript #101: Nobel Prize awarded to a Python convert

Return to episode page view on github
Recorded on Monday, Oct 22, 2018.

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

00:05 This is episode 101, recorded October 22nd, 2018. I'm Michael Kennedy.

00:10 And I'm Brian Okken.

00:11 Hey, Brian. It's good to be back together.

00:12 Yeah, Python Bytes 101. It's like an introductory course or something.

00:16 I know. It's beginning Python news for everybody.

00:19 In fact, we have some very advanced academic stuff that we're going to be covering and some very, very cool frameworks.

00:24 Before we get to those, though, let's say thank you to DigitalOcean.

00:28 They're sponsoring Python Bytes for the entire rest of the year.

00:32 So that's a huge support from them, and we really appreciate it. Thank you.

00:35 Check them out at pythonbytes.fm/DigitalOcean. More about that later.

00:39 You seem to be picking a fight with asterisks. What's going on here? There's a lot of asterisks in your notes.

00:43 I just asterisks love asterisks.

00:47 Asterisks, asterisks, asterisks.

00:49 Yeah. What do you get in Python if you have four asterisks? Come on.

00:52 Seg fault? I don't know. Anyway, sorry. I'm derailing you. Keep going.

00:56 No, I just had – it's one of those things that, like, they're all over the place.

01:01 But I thought we covered something like this, but I couldn't find it in our show.

01:04 We covered underscore. We covered underscore.

01:06 Right. Underscore has so many meanings. Parentheses have many, many meanings.

01:10 And asterisks as well, which I think is really interesting.

01:15 Like, Python's pretty light on the syntax in the sort of symbol form.

01:18 But those three things, they do a lot.

01:21 They do a lot.

01:22 They mean different things, right? So take a serious one.

01:24 Yeah. So this is an article from Trey Hunter.

01:27 Asterisks in Python.

01:28 What they are and how to use them.

01:32 And it covers, at the beginning, say, yes, of course you can do, like, two asterisks five.

01:38 And that's multiplication.

01:39 And if you do two asterisks together, like, two asterisks, asterisks five, that's, like, two.

01:46 It's exponents.

01:47 That's how you do exponents.

01:48 But that's just, like, covered in the first few lines.

01:51 And that's what he's really talking about is all the other uses.

01:54 And I'm starting to use these more, a lot of these different ones more now.

01:59 But, for instance, you can use them if you've got a list, one of the first one he starts with, you might use this.

02:06 If you've got a list and you want to pass it to a function, but the function doesn't take a list, it takes a whole bunch of arguments,

02:15 you can put an asterisk in front of the list and it'll get unpacked for you.

02:19 It's parameter unpacking.

02:21 I don't think you can unpack not as a parameter.

02:25 You can unpack to repack, but I don't think you can just pass it to a value or something.

02:30 Yeah, it's really interesting how you can do that, you know, also when you're unpacking tuples and all sorts of interesting stuff there, right?

02:37 Yeah, you can unpack tuples and lists.

02:39 And then the two asterisks is to unpack keyword arguments.

02:43 So if you've got a dictionary that holds your keyword arguments and you're going to pass them to a function,

02:48 you can unpack them first and send them on their way.

02:51 And Python 3.6, you can use them to build dictionaries as well.

02:54 So you say curly, star, star, dictionary one, comma, star, star, dictionary two, close curly,

02:59 and that creates a dictionary that's basically the union of those two.

03:03 Wow.

03:03 Okay.

03:04 Yeah.

03:04 The star, the asterisks, they go crazy just like the underscore.

03:07 Yeah.

03:08 So this is actually kind of a hard topic to talk about, but I think it's a good article to review

03:14 and to make sure you understand where things are going or just bookmark it.

03:20 So next time you're confused by somebody else's code, you can go look at what they're doing.

03:24 Yeah.

03:24 That's a good article by Jay Hunter.

03:25 I like it.

03:26 Yeah.

03:26 One of the things that I've actually learned from him, I think, is the way to, this is,

03:32 I think it's a three, six thing where it came in, where you can, in your parameter list,

03:37 a function of a function, when you're defining it, you can, at some point, put an asterisk on one of your items.

03:46 And from there on, those items are, they have to be keyword.

03:51 You can't pass them in positionally.

03:52 They have to be keyword arguments.

03:54 Yeah.

03:55 That's really nice because if you, you can name the arguments or you could use positional one,

04:00 or you could add the star, star, could have the args thing.

04:03 But this means, you know, basically you can say, you can take a regular argument list and turn it

04:09 into required only keyword arguments by putting the star as one of the parameters, which is

04:14 non-obvious, but very cool.

04:16 Yeah.

04:16 Yeah.

04:16 You want to know what framework is really awesome that uses that as a core feature in it?

04:21 No.

04:22 What?

04:23 Responder.

04:23 The Responder web framework from Kenneth Wright, which is a brand new web framework.

04:27 It's a little bit like Flask, but you know, he has requests and then what responds to requests?

04:35 Well, Responder responds to requests, right?

04:37 Yeah.

04:37 So I think if people haven't heard of it, I'm sure some folks have because it's been out for a week or so.

04:42 A week or so.

04:43 Yeah.

04:43 So what that means is it already has like 1,300, 1,400 GitHub stars because it's kind of

04:49 work and it's been out for like a week and a half.

04:51 Yeah.

04:52 Which is pretty cool.

04:53 So very popular.

04:54 And it's sort of the web side, the server side equivalent of his request API.

05:00 And he's trying to make something a little like Flask, but more friendly, easier to work with,

05:05 easier to test, things like that.

05:08 Okay.

05:08 So let me run through some of the things that it does as its core features.

05:12 It has a pleasant API, which is cool with a single import statement.

05:16 So, you know, you would expect Kenneth to put together a suite API.

05:20 It has class-based views without inheritance.

05:22 It's naturally first an asynchronous web framework.

05:27 So it supports async and await and it comes with an ASGI web server.

05:33 So you can just run it and it will start processing asynchronous requests, whereas, you know, Flask

05:38 and those things don't have that yet.

05:39 So that's pretty, that's a pretty big thing because it's good, easy to support web sockets.

05:44 You can take an existing WSGI app, like Flask or Pyramid, and mount it as a sub route.

05:50 So what that means is if I have some, let's say I have a blog or, you know, an ordering system,

05:56 and then I want to like plug that in as a sub part of this, I don't have to rewrite that.

06:00 I can just like mount that as a URL and anything in, say, under slash store goes to that implementation.

06:07 And the rest is this new app.

06:08 So that's a pretty cool feature, right?

06:10 Yeah.

06:10 It also makes it so you can split up the responsibility of maintenance and stuff.

06:14 Yeah.

06:14 It's very, yeah, yeah.

06:16 You could break it up like one team manages this part, another team manages that.

06:19 But on the server side, it looks like all one thing.

06:22 I suspect you could probably pull it off with like Nginx and stuff, but this way you don't

06:26 have to, you know, do it in infrastructure.

06:29 You can, you can do it in your Python code.

06:31 It has a background task support, GraphQL, OpenAPI, schema generation, which is cool.

06:37 SPA, single page app support.

06:40 Let's see.

06:42 It's built on top of UVicorn, which is one of the faster asyncio loops, like UV loop

06:47 and so on.

06:48 And yeah, it's even got a nice ASGI support, like I said, for async stuff.

06:54 So I don't know if the world needs more web frameworks.

06:56 It feels like we have a lot of these, but I also feel like this is going to be a massive

07:00 success just the way you look at it.

07:03 Yeah.

07:03 And a lot of them are building on top of what other people have learned.

07:06 And so it's okay to keep rolling out new ones.

07:09 Yeah.

07:10 So one of the things, you know, maybe you'd like this a little better, Brian.

07:13 One of the things with Flask is it has this sort of ambient request that doesn't get passed

07:19 to the method.

07:19 It's just, you know, there like a global variable, but it's thread local or something like this,

07:24 which means it's a little harder to test.

07:26 Right.

07:26 Because how do you mock out that thing properly all the time?

07:29 And this one takes the request and the response so you can modify the response real easily.

07:34 And then it says star comma, and then all the values that go into the route, like slash curly

07:40 variable name, those just become keyword arguments using exactly that thing you were talking about.

07:45 Oh, nice.

07:46 Okay.

07:46 That's cool, right?

07:47 Yeah.

07:47 Anyway, so if people want to see what can it's up to with this web framework, it seems like

07:52 it's getting some traction.

07:52 That's pretty cool.

07:54 And even though it's just started, they've already, he's got a built-in test client for

07:59 it.

07:59 So that's cool.

08:00 Yeah.

08:01 Check that out.

08:02 Yeah, absolutely.

08:02 All right.

08:03 What's your next one you got?

08:04 Let me see.

08:06 It's down the line.

08:07 Just a sec.

08:07 It's hiding.

08:08 It's hiding.

08:08 Yeah.

08:09 So I ran across, I actually saw somebody reference this website because the website is pythonprogramming.in.

08:17 I'm not sure what the IN is.

08:19 Anyway, pythonprogramming.in.

08:22 And it was, they were reference, looking at the, referencing the pandas examples, but

08:27 it's, it's got a lot more.

08:29 It looks like kind of a tutorial on Python.

08:32 And then, so it has just short descriptions and actually short or no descriptions.

08:38 I'm just really short.

08:40 Titles, basically.

08:41 Yeah.

08:42 Titles with, well, a little paragraph of what's going on and then a little code snippet.

08:47 And then the example, the output of the examples.

08:50 So it's teaching just through code and examples for the most part.

08:53 But it goes through, like, starts out with Python basics and then date times and strings

08:58 and dictionaries.

08:58 But then quickly jumps into pandas, matplodlib, and then even TensorFlow.

09:04 There are many, many topics on, say, pandas, for example.

09:08 There's probably four to five pages.

09:11 And each one of those is like an article and a bunch of sample code and stuff, right?

09:15 Or at least some sample code.

09:16 Yeah.

09:17 And also, the way they're doing a lot of these examples, titles are kind of not how it's

09:24 implemented, but what you want to get done.

09:26 So that's kind of neat.

09:28 Yeah, that's a good point.

09:28 Yeah, that's nice because you maybe don't know when you're new.

09:31 Yeah.

09:32 How do I Google this?

09:33 I want to do this thing.

09:34 I just know I have this problem.

09:35 How the heck do I solve this?

09:37 Yeah.

09:37 Yeah, that's pretty cool.

09:38 So it looks like it's probably a really good resource if I'm somewhat new to Python,

09:43 maybe entirely new, and I want to do data science.

09:46 Because it goes through all the basics of the language and then pandas, math, plotlib,

09:50 and TensorFlow.

09:51 Yeah.

09:52 It's like a total deep end crash course, but pretty nice looking.

09:56 And it's cool.

09:57 Awesome.

09:57 Well, it looks like a great resource, especially for people learning data science.

10:01 I know that's one of the hot areas, and a lot of people are getting jobs there.

10:04 And so that's awesome.

10:05 Well, what do you got for us?

10:06 Well, before I tell you about the next thing, which I am quite excited about, maybe if I were

10:11 super lucky, I could make this into a full episode somehow on Talk Python.

10:14 We will see.

10:15 But first, I want to tell you about Kubernetes over at DigitalOcean.

10:19 So DigitalOcean has now announced their Kubernetes cluster and support.

10:25 So for as little as $5, you can spin up a droplet, their terminology for a virtual machine.

10:31 And it comes pre-configured to be a Kubernetes cluster.

10:35 So if you want to work with Docker and group this stuff with Kubernetes and just get rolling

10:41 with things like zero downtime, upgrades, downgrades, all that kind of stuff, scaling, Kubernetes is

10:48 really great to do that.

10:49 And you can do it cheap and easy on DigitalOcean.

10:51 So check them out at pythonbytes.fm/DigitalOcean and get started.

10:55 And if you're a new user there, you get $100 credit to play with Kubernetes and other things

11:00 as well.

11:00 Yeah.

11:01 They also have GPU based systems and high compute stuff if you want to do data science over there.

11:06 So that's pretty awesome.

11:08 The next thing that I have has to do with Sweden, actually.

11:12 With Sweden?

11:13 Yeah, with Sweden.

11:14 Sweden's pretty awesome.

11:15 I haven't got to spend much time in Sweden, but I definitely like the place.

11:19 And the news is there's these two American economists who have won the Nobel Prize in economics, hence

11:27 Sweden.

11:27 Oh, okay.

11:29 Right, because that's who hands out the Nobel Prize.

11:30 And interesting.

11:32 Okay, so they're economists.

11:33 They won the Nobel Prize.

11:34 It was Nordhaus and Romer.

11:37 They basically designed some ways to model and analyze how to sustain economic growth in

11:46 a global economy like it is, and also what destroys it.

11:49 So it's basically like a theory of the welfare of the world's population and economy, which

11:54 is pretty cool.

11:54 But why am I talking about it?

11:56 Because one of the guys, I think Romer, pretty sure it's Romer.

12:01 Yeah, Romer, has become a Python and Jupyter convert and doing his work and his publishing

12:08 for his Nobel Prize with Jupyter and Python.

12:11 Oh, that's so cool.

12:12 Isn't that sweet?

12:12 Yeah.

12:13 So first of all, the guy is 62 years old, and he's just switched to Python, which is awesome.

12:19 Yeah, that's great.

12:20 So he said he believes that research should be transparent, and he really thinks it's important

12:26 that it's open and reproducible.

12:28 And like most academics, he worked in some other closed, ultra-expensive thing.

12:33 So he worked in Mathematica, right?

12:35 Mathematics, when he's paid things.

12:36 And he said he tried to share his work, right?

12:40 This Nobel Prize-winning work, he tried to share it, and he said he couldn't do it.

12:43 Wolfram Research, who makes Mathematica, basically made it impossible to share his research without

12:49 the people receiving it also having Mathematica, the paid version.

12:53 Oh, yeah.

12:54 That's lame.

12:54 Yeah, it's totally lame.

12:55 So he has some pretty interesting comments.

12:56 He says he believes the open-source notebooks are the way forward for shared research, and

13:03 he believes they support integrity while proprietary software encourages secrecy.

13:09 And he went to say, quote, the more I learn about proprietary software, the more I worry that

13:15 objective truth might perish from the earth.

13:18 He wrote.

13:18 So how's that for a statement?

13:21 Yeah.

13:21 That's pretty wild.

13:22 So anyway, there's a short article.

13:23 You can check it out.

13:24 It actually links to a bunch of his blog posts and his writings from Dr. Romer.

13:28 That's cool.

13:28 I actually also interviewed the folks that won the Nobel Prize in physics at CERN, not Higgs,

13:35 but the people on the team that did the research, like the leaders of some of the teams there,

13:39 on Talk Python way, way back.

13:42 And I'm going to link to that.

13:43 I think it was episode 29 about CERN.

13:45 That was pretty awesome.

13:46 Yeah.

13:47 That was a great episode.

13:48 Yeah, thanks.

13:49 It's one of my favorites.

13:50 And I'd like to actually hear more about people.

13:52 It's neat seeing this in economics.

13:54 I'd like to hear more about people using Python in economics.

13:57 Yeah, yeah.

13:58 I mean, I might send them a message and say, hey, if you got the time, I'm sure you're busy,

14:02 but, you know, come on the show.

14:03 That'd be awesome.

14:04 All right.

14:04 What's your next one?

14:05 Speaking of science, so that last link we had had some basics of TensorFlow.

14:10 But if you really want to jump into it, we've got, there's a GitHub repo that has simple

14:17 and ready to use tutorials for TensorFlow in a whole bunch of different, in the repo.

14:22 So you can kind of get started and get kind of deep into it with some open source examples.

14:28 So that's what I have to share, really.

14:31 Nice.

14:31 You know, I feel like I really just need to take some time and learn some of the AI machine

14:37 learning stuff.

14:37 It's really interesting.

14:39 It seems super approachable.

14:41 It's just, I don't know how you feel, Brian.

14:43 But for me, it's like I need to have a problem to solve to really learn something.

14:48 Yeah, I definitely agree.

14:50 I'm trying to figure out how to, and since with, I work with communication systems and

14:55 measurement of those.

14:56 And I think that there's some room there that I could possibly use some machine learning or

15:01 something in that realm.

15:02 Yeah, you probably can.

15:03 Yeah.

15:04 You know, the folks over at Netflix, they use machine learning to analyze and watch all their

15:08 servers because they have too many for humans to understand.

15:11 And basically the system knows when it's broken before they do.

15:15 Yeah.

15:17 Yeah.

15:17 So that's pretty awesome.

15:18 So maybe it works for radios as well as servers.

15:20 Yeah, maybe.

15:21 That'd be cool.

15:22 Possibly.

15:22 So the final thing is something that people might actually be super interested in being

15:28 part of.

15:28 And it's going to be available at the time of this recording for 31 more days, but probably

15:35 the time it ships, maybe 28 days.

15:37 Who knows?

15:37 Something like this.

15:38 Is this thing called Makerphone.

15:41 Have you heard of this?

15:42 I have.

15:43 It's pretty darn cool.

15:44 So Makerphone is from this guy named Albert in Croatia, and he had made something previously.

15:50 And what was it called?

15:52 I can't remember.

15:52 It was like a little handheld, almost like a Nintendo NES that you could program with super

15:59 basic graphics.

16:00 It was pretty interesting.

16:01 Yeah.

16:01 The problem was that you programmed in C.

16:03 What this is, Makerphone is a smartphone with a screen that you program in Python.

16:10 Well, yes.

16:12 It's super cool.

16:13 Smartphone is a little bit of a stretch.

16:15 Yeah.

16:15 Smartphone in quotes.

16:16 Yeah.

16:16 It's not super smart, but it does have a screen.

16:19 It does.

16:19 I don't think it has a touchscreen, but it has a screen and a little keypad.

16:23 Yeah.

16:23 And also, I like this one because you can basically choose your level of commitment to the DIY

16:28 do-it-yourself aspect.

16:30 You can back the Kickstarter at a level that will get you just the true experience.

16:36 Here's the boards.

16:37 Here's the wires and the soldering.

16:40 Go to town on these instructions.

16:42 Or for like a little tiny bit more, you can get it assembled so you could just write the

16:47 software.

16:48 Yeah.

16:48 That's pretty cool.

16:49 Yeah.

16:50 So, I actually backed this at the software level because I'm busy.

16:53 I can't be soldering stuff.

16:55 I would like to, but I'm afraid I'll just not do it.

16:58 So, I'd rather just try the software side.

16:59 That's pretty cool that you backed it.

17:00 I can't wait to see it.

17:01 I was thinking about it.

17:02 One of the neat things about the-we've watched the video.

17:05 Some of the belief of the-it's a small company around this-is that it isn't to try to

17:11 get you a cheap phone.

17:12 It's to help teach people.

17:15 So, it's trying to get people excited about, yeah, learning how to solder parts together,

17:20 learning how to program stuff, getting all this working, and with like a webpage that'll

17:25 walk everybody through whatever they need to do with it.

17:29 And that sort of thing is neat because it's missing out of a lot of places.

17:33 I mean, we don't have Radio Shacks anymore.

17:35 So, people have to do this maker things to figure out some of this stuff.

17:39 Yeah.

17:39 It looks really, really fun, and I'm excited to do it.

17:42 You can program it in Scratch or Python.

17:46 It's also Arduino-based.

17:48 So, you probably can program it in C++ as well.

17:50 I'm excited.

17:51 The reason I got it is my daughter is really into making websites with Python, like simple,

17:57 super, super simple ones with, say, Anvil, where she can kind of drag you, drop you some

18:04 stuff together and put like a silly dropdown in a picture or something.

18:07 You know, something really simple.

18:08 But I feel like we could sit down and make some little simple games, like, you know,

18:12 a little Pong Banks game or something on this phone, and I bet you'll love it.

18:16 We'll see.

18:16 That's the goal anyway.

18:17 Yeah.

18:18 And even if you already have it pre-built, I'm sure you could take it apart and look out

18:22 what's inside and everything.

18:23 Yeah, absolutely.

18:24 So, this, and it'll be for sale afterwards.

18:26 They made that NES-like thing previously, which I talked about.

18:30 That's still for sale, not too expensive.

18:33 So, one of the things about Kickstarter is, will the thing actually become a reality, right?

18:38 They put it, you know, this one, it was, the goal has to be $15,000 in order for them

18:43 to do it.

18:43 Yeah, they hit that right away.

18:46 Yeah, I don't know how many days it's been out for, but it's at $186,000 pledged and 31

18:53 days to go.

18:53 So, I bet this thing hits half a million.

18:55 Yeah.

18:57 Especially now that we covered it on the show.

18:58 I mean, they didn't pay us anything.

19:00 I just think this is super interesting.

19:01 The Python angle's awesome.

19:02 But, I bet it hits half a million.

19:04 Yeah, it's pretty neat.

19:05 What's crazy, Brian, is this guy did the first project when he was, as a Kickstarter, when

19:09 he was 18.

19:10 I didn't bother to look, actually, what that brought in.

19:13 Now, he's much more mature.

19:15 He's been working this for a while.

19:16 He's now 20.

19:17 Isn't this cool for a guy who's 20 to be doing this?

19:19 Well, it is.

19:19 And that's one of the neat things about this project, also, is that it's not his first

19:24 project.

19:24 So, now that you've done it, you've got to actually build it.

19:27 He's already done that.

19:28 Yeah.

19:29 There's a good chance it won't be Vaporware, because he's selling the previous Kickstarter

19:32 thing.

19:32 Yeah.

19:33 Yep.

19:33 Pretty awesome.

19:34 Well, I'm excited to get mine and build Pong with my daughter.

19:37 All right.

19:38 Cool.

19:38 Awesome.

19:40 I did want to throw out one more thing really quick.

19:43 So, there's been all this talk about Python 2 versus Python 3, you know, legacy Python,

19:48 modern Python, what's going to happen.

19:50 Well, you know, PHP has something not terribly different going on.

19:53 Really?

19:54 There's this article.

19:55 I'm just going to read you the title.

19:56 I think it's overgeneralizing.

19:58 Anyway, the title is, around 62% of all internet sites will run an unsupported PHP version in

20:05 10 weeks.

20:05 I don't know if it's actually 62% of all sites are all PHP-based sites, but WordPress is so

20:11 prevalent on the internet that, you know, that's probably not a super big difference.

20:16 I don't know.

20:16 But it's pretty interesting to see the conversations and some people are saying, I think it's sort

20:22 of a shadow of what's to come in 2020 for Python 2 when it goes out of date as well.

20:28 So, it's just an interesting article.

20:30 I'll throw it out there.

20:31 Basically, the summary is the highly popular PHP 5 branch will stop receiving security updates

20:37 at the end of the year, just like Python 2 will next year.

20:40 Yeah.

20:41 Okay.

20:41 Yeah.

20:41 Anyway, parallels.

20:42 Well, that's a show, man.

20:44 It's definitely a show.

20:45 And we are into triple digits properly now with 101.

20:49 So, what's the next one?

20:50 201?

20:51 I guess.

20:51 Was this a prerequisite for the next one?

20:53 You know, what's the...

20:56 Nah, it'll be fun.

20:56 It's been great to do it and we're going to keep cranking out.

20:59 It'll be 102, I suppose.

21:00 Probably.

21:01 Yeah.

21:01 That makes sense.

21:02 It does.

21:03 All right.

21:04 With, you know, counting and all that.

21:05 Talk to you next week.

21:08 See ya.

21:08 Bye.

21:08 Thank you for listening to Python Bytes.

21:11 Follow the show on Twitter via at Python Bytes.

21:13 That's Python Bytes as in B-Y-T-E-S.

21:16 And get the full show notes at pythonbytes.fm.

21:20 If you have a news item you want featured, just visit pythonbytes.fm and send it our way.

21:24 We're always on the lookout for sharing something cool.

21:27 On behalf of myself and Brian Okken, this is Michael Kennedy.

21:30 Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page