Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 101, recorded October 22nd, 2018. I'm Michael Kennedy.
And I'm Brian Okken.
Hey, Brian. It's good to be back together.
Yeah, Python Bytes 101. It's like an introductory course or something.
I know. It's beginning Python news for everybody.
In fact, we have some very advanced academic stuff that we're going to be covering and some very, very cool frameworks.
Before we get to those, though, let's say thank you to DigitalOcean.
They're sponsoring Python Bytes for the entire rest of the year.
So that's a huge support from them, and we really appreciate it. Thank you.
Check them out at pythonbytes.fm/DigitalOcean. More about that later.
You seem to be picking a fight with asterisks. What's going on here? There's a lot of asterisks in your notes.
I just asterisks love asterisks.
Asterisks, asterisks, asterisks.
Yeah. What do you get in Python if you have four asterisks? Come on.
Seg fault? I don't know. Anyway, sorry. I'm derailing you. Keep going.
No, I just had – it's one of those things that, like, they're all over the place.
But I thought we covered something like this, but I couldn't find it in our show.
We covered underscore. We covered underscore.
Right. Underscore has so many meanings. Parentheses have many, many meanings.
And asterisks as well, which I think is really interesting.
Like, Python's pretty light on the syntax in the sort of symbol form.
But those three things, they do a lot.
They do a lot.
They mean different things, right? So take a serious one.
Yeah. So this is an article from Trey Hunter.
Asterisks in Python.
What they are and how to use them.
And it covers, at the beginning, say, yes, of course you can do, like, two asterisks five.
And that's multiplication.
And if you do two asterisks together, like, two asterisks, asterisks five, that's, like, two.
It's exponents.
That's how you do exponents.
But that's just, like, covered in the first few lines.
And that's what he's really talking about is all the other uses.
And I'm starting to use these more, a lot of these different ones more now.
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.
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,
you can put an asterisk in front of the list and it'll get unpacked for you.
It's parameter unpacking.
I don't think you can unpack not as a parameter.
You can unpack to repack, but I don't think you can just pass it to a value or something.
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?
Yeah, you can unpack tuples and lists.
And then the two asterisks is to unpack keyword arguments.
So if you've got a dictionary that holds your keyword arguments and you're going to pass them to a function,
you can unpack them first and send them on their way.
And Python 3.6, you can use them to build dictionaries as well.
So you say curly, star, star, dictionary one, comma, star, star, dictionary two, close curly,
and that creates a dictionary that's basically the union of those two.
Wow.
Okay.
Yeah.
The star, the asterisks, they go crazy just like the underscore.
Yeah.
So this is actually kind of a hard topic to talk about, but I think it's a good article to review
and to make sure you understand where things are going or just bookmark it.
So next time you're confused by somebody else's code, you can go look at what they're doing.
Yeah.
That's a good article by Jay Hunter.
I like it.
Yeah.
One of the things that I've actually learned from him, I think, is the way to, this is,
I think it's a three, six thing where it came in, where you can, in your parameter list,
a function of a function, when you're defining it, you can, at some point, put an asterisk on one of your items.
And from there on, those items are, they have to be keyword.
You can't pass them in positionally.
They have to be keyword arguments.
Yeah.
That's really nice because if you, you can name the arguments or you could use positional one,
or you could add the star, star, could have the args thing.
But this means, you know, basically you can say, you can take a regular argument list and turn it
into required only keyword arguments by putting the star as one of the parameters, which is
non-obvious, but very cool.
Yeah.
You want to know what framework is really awesome that uses that as a core feature in it?
No.
What?
Responder.
The Responder web framework from Kenneth Wright, which is a brand new web framework.
It's a little bit like Flask, but you know, he has requests and then what responds to requests?
Well, Responder responds to requests, right?
Yeah.
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.
A week or so.
Yeah.
So what that means is it already has like 1,300, 1,400 GitHub stars because it's kind of
work and it's been out for like a week and a half.
Yeah.
Which is pretty cool.
So very popular.
And it's sort of the web side, the server side equivalent of his request API.
And he's trying to make something a little like Flask, but more friendly, easier to work with,
easier to test, things like that.
Okay.
So let me run through some of the things that it does as its core features.
It has a pleasant API, which is cool with a single import statement.
So, you know, you would expect Kenneth to put together a suite API.
It has class-based views without inheritance.
It's naturally first an asynchronous web framework.
So it supports async and await and it comes with an ASGI web server.
So you can just run it and it will start processing asynchronous requests, whereas, you know, Flask
and those things don't have that yet.
So that's pretty, that's a pretty big thing because it's good, easy to support web sockets.
You can take an existing WSGI app, like Flask or Pyramid, and mount it as a sub route.
So what that means is if I have some, let's say I have a blog or, you know, an ordering system,
and then I want to like plug that in as a sub part of this, I don't have to rewrite that.
I can just like mount that as a URL and anything in, say, under slash store goes to that implementation.
And the rest is this new app.
So that's a pretty cool feature, right?
Yeah.
It also makes it so you can split up the responsibility of maintenance and stuff.
Yeah.
It's very, yeah, yeah.
You could break it up like one team manages this part, another team manages that.
But on the server side, it looks like all one thing.
I suspect you could probably pull it off with like Nginx and stuff, but this way you don't
have to, you know, do it in infrastructure.
You can, you can do it in your Python code.
It has a background task support, GraphQL, OpenAPI, schema generation, which is cool.
SPA, single page app support.
Let's see.
It's built on top of UVicorn, which is one of the faster asyncio loops, like uv loop
and so on.
And yeah, it's even got a nice ASGI support, like I said, for async stuff.
So I don't know if the world needs more web frameworks.
It feels like we have a lot of these, but I also feel like this is going to be a massive
success just the way you look at it.
Yeah.
And a lot of them are building on top of what other people have learned.
And so it's okay to keep rolling out new ones.
Yeah.
So one of the things, you know, maybe you'd like this a little better, Brian.
One of the things with Flask is it has this sort of ambient request that doesn't get passed
to the method.
It's just, you know, there like a global variable, but it's thread local or something like this,
which means it's a little harder to test.
Right.
Because how do you mock out that thing properly all the time?
And this one takes the request and the response so you can modify the response real easily.
And then it says star comma, and then all the values that go into the route, like slash curly
variable name, those just become keyword arguments using exactly that thing you were talking about.
Oh, nice.
Okay.
That's cool, right?
Yeah.
Anyway, so if people want to see what can it's up to with this web framework, it seems like
it's getting some traction.
That's pretty cool.
And even though it's just started, they've already, he's got a built-in test client for
it.
So that's cool.
Yeah.
Check that out.
Yeah, absolutely.
All right.
What's your next one you got?
Let me see.
It's down the line.
Just a sec.
It's hiding.
Yeah.
So I ran across, I actually saw somebody reference this website because the website is pythonprogramming.in.
I'm not sure what the IN is.
Anyway, pythonprogramming.in.
And it was, they were reference, looking at the, referencing the pandas examples, but
it's, it's got a lot more.
It looks like kind of a tutorial on Python.
And then, so it has just short descriptions and actually short or no descriptions.
I'm just really short.
Titles, basically.
Yeah.
Titles with, well, a little paragraph of what's going on and then a little code snippet.
And then the example, the output of the examples.
So it's teaching just through code and examples for the most part.
But it goes through, like, starts out with Python basics and then date times and strings
and dictionaries.
But then quickly jumps into pandas, matplodlib, and then even TensorFlow.
There are many, many topics on, say, pandas, for example.
There's probably four to five pages.
And each one of those is like an article and a bunch of sample code and stuff, right?
Or at least some sample code.
Yeah.
And also, the way they're doing a lot of these examples, titles are kind of not how it's
implemented, but what you want to get done.
So that's kind of neat.
Yeah, that's a good point.
Yeah, that's nice because you maybe don't know when you're new.
Yeah.
How do I Google this?
I want to do this thing.
I just know I have this problem.
How the heck do I solve this?
Yeah.
Yeah, that's pretty cool.
So it looks like it's probably a really good resource if I'm somewhat new to Python,
maybe entirely new, and I want to do data science.
Because it goes through all the basics of the language and then pandas, math, plotlib,
and TensorFlow.
Yeah.
It's like a total deep end crash course, but pretty nice looking.
And it's cool.
Awesome.
Well, it looks like a great resource, especially for people learning data science.
I know that's one of the hot areas, and a lot of people are getting jobs there.
And so that's awesome.
Well, what do you got for us?
Well, before I tell you about the next thing, which I am quite excited about, maybe if I were
super lucky, I could make this into a full episode somehow on Talk Python.
We will see.
But first, I want to tell you about Kubernetes over at DigitalOcean.
So DigitalOcean has now announced their Kubernetes cluster and support.
So for as little as $5, you can spin up a droplet, their terminology for a virtual machine.
And it comes pre-configured to be a Kubernetes cluster.
So if you want to work with Docker and group this stuff with Kubernetes and just get rolling
with things like zero downtime, upgrades, downgrades, all that kind of stuff, scaling, Kubernetes is
really great to do that.
And you can do it cheap and easy on DigitalOcean.
So check them out at pythonbytes.fm/DigitalOcean and get started.
And if you're a new user there, you get $100 credit to play with Kubernetes and other things
as well.
Yeah.
They also have GPU based systems and high compute stuff if you want to do data science over there.
So that's pretty awesome.
The next thing that I have has to do with Sweden, actually.
With Sweden?
Yeah, with Sweden.
Sweden's pretty awesome.
I haven't got to spend much time in Sweden, but I definitely like the place.
And the news is there's these two American economists who have won the Nobel Prize in economics, hence
Sweden.
Oh, okay.
Right, because that's who hands out the Nobel Prize.
And interesting.
Okay, so they're economists.
They won the Nobel Prize.
It was Nordhaus and Romer.
They basically designed some ways to model and analyze how to sustain economic growth in
a global economy like it is, and also what destroys it.
So it's basically like a theory of the welfare of the world's population and economy, which
is pretty cool.
But why am I talking about it?
Because one of the guys, I think Romer, pretty sure it's Romer.
Yeah, Romer, has become a Python and Jupyter convert and doing his work and his publishing
for his Nobel Prize with Jupyter and Python.
Oh, that's so cool.
Isn't that sweet?
Yeah.
So first of all, the guy is 62 years old, and he's just switched to Python, which is awesome.
Yeah, that's great.
So he said he believes that research should be transparent, and he really thinks it's important
that it's open and reproducible.
And like most academics, he worked in some other closed, ultra-expensive thing.
So he worked in Mathematica, right?
Mathematics, when he's paid things.
And he said he tried to share his work, right?
This Nobel Prize-winning work, he tried to share it, and he said he couldn't do it.
Wolfram Research, who makes Mathematica, basically made it impossible to share his research without
the people receiving it also having Mathematica, the paid version.
Oh, yeah.
That's lame.
Yeah, it's totally lame.
So he has some pretty interesting comments.
He says he believes the open-source notebooks are the way forward for shared research, and
he believes they support integrity while proprietary software encourages secrecy.
And he went to say, quote, the more I learn about proprietary software, the more I worry that
objective truth might perish from the earth.
He wrote.
So how's that for a statement?
Yeah.
That's pretty wild.
So anyway, there's a short article.
You can check it out.
It actually links to a bunch of his blog posts and his writings from Dr. Romer.
That's cool.
I actually also interviewed the folks that won the Nobel Prize in physics at CERN, not Higgs,
but the people on the team that did the research, like the leaders of some of the teams there,
on Talk Python way, way back.
And I'm going to link to that.
I think it was episode 29 about CERN.
That was pretty awesome.
Yeah.
That was a great episode.
Yeah, thanks.
It's one of my favorites.
And I'd like to actually hear more about people.
It's neat seeing this in economics.
I'd like to hear more about people using Python in economics.
Yeah, yeah.
I mean, I might send them a message and say, hey, if you got the time, I'm sure you're busy,
but, you know, come on the show.
That'd be awesome.
All right.
What's your next one?
Speaking of science, so that last link we had had some basics of TensorFlow.
But if you really want to jump into it, we've got, there's a GitHub repo that has simple
and ready to use tutorials for TensorFlow in a whole bunch of different, in the repo.
So you can kind of get started and get kind of deep into it with some open source examples.
So that's what I have to share, really.
Nice.
You know, I feel like I really just need to take some time and learn some of the AI machine
learning stuff.
It's really interesting.
It seems super approachable.
It's just, I don't know how you feel, Brian.
But for me, it's like I need to have a problem to solve to really learn something.
Yeah, I definitely agree.
I'm trying to figure out how to, and since with, I work with communication systems and
measurement of those.
And I think that there's some room there that I could possibly use some machine learning or
something in that realm.
Yeah, you probably can.
Yeah.
You know, the folks over at Netflix, they use machine learning to analyze and watch all their
servers because they have too many for humans to understand.
And basically the system knows when it's broken before they do.
Yeah.
So that's pretty awesome.
So maybe it works for radios as well as servers.
Yeah, maybe.
That'd be cool.
Possibly.
So the final thing is something that people might actually be super interested in being
part of.
And it's going to be available at the time of this recording for 31 more days, but probably
the time it ships, maybe 28 days.
Who knows?
Something like this.
Is this thing called Makerphone.
Have you heard of this?
I have.
It's pretty darn cool.
So Makerphone is from this guy named Albert in Croatia, and he had made something previously.
And what was it called?
I can't remember.
It was like a little handheld, almost like a Nintendo NES that you could program with super
basic graphics.
It was pretty interesting.
Yeah.
The problem was that you programmed in C.
What this is, Makerphone is a smartphone with a screen that you program in Python.
Well, yes.
It's super cool.
Smartphone is a little bit of a stretch.
Yeah.
Smartphone in quotes.
Yeah.
It's not super smart, but it does have a screen.
It does.
I don't think it has a touchscreen, but it has a screen and a little keypad.
Yeah.
And also, I like this one because you can basically choose your level of commitment to the DIY
do-it-yourself aspect.
You can back the Kickstarter at a level that will get you just the true experience.
Here's the boards.
Here's the wires and the soldering.
Go to town on these instructions.
Or for like a little tiny bit more, you can get it assembled so you could just write the
software.
Yeah.
That's pretty cool.
Yeah.
So, I actually backed this at the software level because I'm busy.
I can't be soldering stuff.
I would like to, but I'm afraid I'll just not do it.
So, I'd rather just try the software side.
That's pretty cool that you backed it.
I can't wait to see it.
I was thinking about it.
One of the neat things about the-we've watched the video.
Some of the belief of the-it's a small company around this-is that it isn't to try to
get you a cheap phone.
It's to help teach people.
So, it's trying to get people excited about, yeah, learning how to solder parts together,
learning how to program stuff, getting all this working, and with like a webpage that'll
walk everybody through whatever they need to do with it.
And that sort of thing is neat because it's missing out of a lot of places.
I mean, we don't have Radio Shacks anymore.
So, people have to do this maker things to figure out some of this stuff.
Yeah.
It looks really, really fun, and I'm excited to do it.
You can program it in Scratch or Python.
It's also Arduino-based.
So, you probably can program it in C++ as well.
I'm excited.
The reason I got it is my daughter is really into making websites with Python, like simple,
super, super simple ones with, say, Anvil, where she can kind of drag you, drop you some
stuff together and put like a silly dropdown in a picture or something.
You know, something really simple.
But I feel like we could sit down and make some little simple games, like, you know,
a little Pong Banks game or something on this phone, and I bet you'll love it.
We'll see.
That's the goal anyway.
Yeah.
And even if you already have it pre-built, I'm sure you could take it apart and look out
what's inside and everything.
Yeah, absolutely.
So, this, and it'll be for sale afterwards.
They made that NES-like thing previously, which I talked about.
That's still for sale, not too expensive.
So, one of the things about Kickstarter is, will the thing actually become a reality, right?
They put it, you know, this one, it was, the goal has to be $15,000 in order for them
to do it.
Yeah, they hit that right away.
Yeah, I don't know how many days it's been out for, but it's at $186,000 pledged and 31
days to go.
So, I bet this thing hits half a million.
Yeah.
Especially now that we covered it on the show.
I mean, they didn't pay us anything.
I just think this is super interesting.
The Python angle's awesome.
But, I bet it hits half a million.
Yeah, it's pretty neat.
What's crazy, Brian, is this guy did the first project when he was, as a Kickstarter, when
he was 18.
I didn't bother to look, actually, what that brought in.
Now, he's much more mature.
He's been working this for a while.
He's now 20.
Isn't this cool for a guy who's 20 to be doing this?
Well, it is.
And that's one of the neat things about this project, also, is that it's not his first
project.
So, now that you've done it, you've got to actually build it.
He's already done that.
Yeah.
There's a good chance it won't be Vaporware, because he's selling the previous Kickstarter
thing.
Yeah.
Yep.
Pretty awesome.
Well, I'm excited to get mine and build Pong with my daughter.
All right.
Cool.
Awesome.
I did want to throw out one more thing really quick.
So, there's been all this talk about Python 2 versus Python 3, you know, legacy Python,
modern Python, what's going to happen.
Well, you know, PHP has something not terribly different going on.
Really?
There's this article.
I'm just going to read you the title.
I think it's overgeneralizing.
Anyway, the title is, around 62% of all internet sites will run an unsupported PHP version in
10 weeks.
I don't know if it's actually 62% of all sites are all PHP-based sites, but WordPress is so
prevalent on the internet that, you know, that's probably not a super big difference.
I don't know.
But it's pretty interesting to see the conversations and some people are saying, I think it's sort
of a shadow of what's to come in 2020 for Python 2 when it goes out of date as well.
So, it's just an interesting article.
I'll throw it out there.
Basically, the summary is the highly popular PHP 5 branch will stop receiving security updates
at the end of the year, just like Python 2 will next year.
Yeah.
Okay.
Yeah.
Anyway, parallels.
Well, that's a show, man.
It's definitely a show.
And we are into triple digits properly now with 101.
So, what's the next one?
201?
I guess.
Was this a prerequisite for the next one?
You know, what's the...
Nah, it'll be fun.
It's been great to do it and we're going to keep cranking out.
It'll be 102, I suppose.
Probably.
Yeah.
That makes sense.
It does.
All right.
With, you know, counting and all that.
Talk to you next week.
See ya.
Bye.
Thank you for listening to Python Bytes.
Follow the show on Twitter via at Python Bytes.
That's Python Bytes as in B-Y-T-E-S.
And get the full show notes at pythonbytes.fm.
If you have a news item you want featured, just visit pythonbytes.fm and send it our way.
We're always on the lookout for sharing something cool.
On behalf of myself and Brian Okken, this is Michael Kennedy.
Thank you for listening and sharing this podcast with your friends and colleagues.