WEBVTT

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

00:00:05.920 --> 00:00:11.400
This is episode 34, recorded July 12, 2017.

00:00:11.400 --> 00:00:12.740
I'm Michael Kennedy.

00:00:12.740 --> 00:00:13.600
And I'm Brian Okken.

00:00:13.600 --> 00:00:15.400
And we've got some great stuff to share with you.

00:00:15.400 --> 00:00:19.640
But Brian, just let everyone know, this episode is brought to you by Rollbar.

00:00:19.640 --> 00:00:23.120
So check them out at pythonbytes.fm/rollbar for some good stuff.

00:00:23.120 --> 00:00:24.080
We'll tell you about that later.

00:00:24.080 --> 00:00:25.640
Right now, I want to hear about logging.

00:00:25.640 --> 00:00:31.520
Yeah, I'm one of those people that know that I should use logging more instead of just print statements.

00:00:31.520 --> 00:00:38.020
But to say it like mildly, the standard library logging package is non-intuitive.

00:00:38.020 --> 00:00:39.140
It's definitely not obvious.

00:00:39.140 --> 00:00:40.380
Yeah, you're like, I got a logger.

00:00:40.380 --> 00:00:40.980
It doesn't work.

00:00:40.980 --> 00:00:41.340
Why?

00:00:41.340 --> 00:00:42.100
What do I do now?

00:00:42.100 --> 00:00:43.920
Yeah, the setting up the config and stuff.

00:00:43.920 --> 00:00:46.740
And I get, anyway, I still get confused about it.

00:00:46.740 --> 00:00:53.100
So I am welcome to look at, or I welcome new logging packages to try to clean that up.

00:00:53.100 --> 00:00:56.700
And there's an article that came out, easy Python logging with Daiquiri.

00:00:56.700 --> 00:01:02.680
And Daiquiri is a logger that works a little bit.

00:01:02.680 --> 00:01:04.840
It's a little bit cleaner and works pretty good.

00:01:04.840 --> 00:01:06.480
I played around with it a little bit.

00:01:06.480 --> 00:01:10.880
But it uses colors in the terminal, of course, which is nice.

00:01:10.880 --> 00:01:12.540
It supports file logging.

00:01:12.540 --> 00:01:16.400
And it's supposedly journal D, which I have no idea what that is.

00:01:16.400 --> 00:01:18.480
I like some of the features of it.

00:01:18.480 --> 00:01:21.840
And what I really like about it is that it just sort of works right away.

00:01:22.020 --> 00:01:23.440
You don't have to do much setup.

00:01:23.440 --> 00:01:27.840
Although you do have to call, like, a get logger and call a setup function.

00:01:27.840 --> 00:01:28.740
But it's not too bad.

00:01:28.740 --> 00:01:33.220
Yeah, it's really similar to the built-in logging, actually, which is super nice.

00:01:33.220 --> 00:01:36.300
And the two things that I like, one is the, well, three things.

00:01:36.300 --> 00:01:38.460
It works just like you create it, and it works.

00:01:38.460 --> 00:01:40.180
You don't have to go and configure it a bunch.

00:01:40.180 --> 00:01:47.160
The other thing is that it prints color messages to standard out or standard error.

00:01:47.600 --> 00:01:50.100
So if a thing is an error, it comes out red.

00:01:50.100 --> 00:01:54.660
If it's good, it comes out, like, bluish or, you know, warnings or yellow, things like that.

00:01:54.660 --> 00:01:54.900
Yeah.

00:01:54.900 --> 00:02:00.040
It does have some, I can't remember what the dependencies are, but it does have some dependencies

00:02:00.040 --> 00:02:02.620
that tripped me up at first when I was installing it.

00:02:02.620 --> 00:02:03.280
Don't know why.

00:02:03.280 --> 00:02:04.980
But then it was easy to install.

00:02:04.980 --> 00:02:05.600
Not too bad.

00:02:05.600 --> 00:02:05.880
Yeah.

00:02:06.260 --> 00:02:09.660
The other thing that's sweet is it does native logging of exceptions.

00:02:09.660 --> 00:02:14.260
So even if you don't catch the exception, it'll, like, print out the exception details, right?

00:02:14.260 --> 00:02:14.760
Oh, yeah.

00:02:14.760 --> 00:02:15.200
That's cool.

00:02:15.200 --> 00:02:15.720
I missed that.

00:02:15.720 --> 00:02:16.180
Yeah, yeah.

00:02:16.180 --> 00:02:16.640
That's slick.

00:02:16.640 --> 00:02:22.140
And then as I was thinking about this today, I just saw somebody mentioning log zero.

00:02:22.140 --> 00:02:23.980
So I went and checked that out this morning.

00:02:23.980 --> 00:02:26.660
And there's a link to it in our show notes.

00:02:26.900 --> 00:02:34.040
But it's also pretty clean, and it has no external dependencies and also does color on the output.

00:02:34.040 --> 00:02:39.180
And a little bit, I mean, if you're doing a quick and dirty thing, it's a little bit, you

00:02:39.180 --> 00:02:40.780
don't, there's no setup required at all.

00:02:40.780 --> 00:02:42.400
Yeah, that's pretty interesting.

00:02:42.400 --> 00:02:42.820
Anyway.

00:02:42.820 --> 00:02:48.000
And the logo of that one is like a beaver with a hard hat and, like, some plans, which is pretty

00:02:48.000 --> 00:02:48.340
interesting.

00:02:48.340 --> 00:02:48.660
Yeah.

00:02:48.660 --> 00:02:54.300
One of the things I'd like to say about Daiquiri is I really had to check my spelling on it.

00:02:54.300 --> 00:02:57.200
The first time I downloaded it, pip installed it, no problem.

00:02:57.200 --> 00:03:00.800
And then I went to import it, and I spelled Daiquiri wrong.

00:03:00.800 --> 00:03:04.380
So it's a D-A-I-Q-U-I-R-I.

00:03:04.380 --> 00:03:09.820
Yeah, I'm not sure I would spell that correctly off the, you know, just off the top of my head

00:03:09.820 --> 00:03:10.060
either.

00:03:10.060 --> 00:03:12.720
But both are fun projects, so check them out.

00:03:12.720 --> 00:03:13.120
Yeah, yeah.

00:03:13.120 --> 00:03:15.580
If you're throwing logging in there, also check out Logbook, another good one.

00:03:15.580 --> 00:03:16.320
Logbook, okay.

00:03:16.320 --> 00:03:19.300
It's by Armin Roedeker from Flask.

00:03:19.300 --> 00:03:19.980
I'll check that out.

00:03:19.980 --> 00:03:22.840
All right, so I have kind of a deep article, a deep thought for us on the next one.

00:03:23.100 --> 00:03:27.760
Python is probably the biggest space where artificial intelligence is done, right?

00:03:27.760 --> 00:03:33.720
Like a lot of the AI machine learning algorithms come out for Python first, or at least come

00:03:33.720 --> 00:03:35.960
with Python right out of the box, right?

00:03:35.960 --> 00:03:43.440
So TensorFlow, Keras, and a bunch of the other things that you might do would probably be done

00:03:43.440 --> 00:03:44.180
in Python.

00:03:44.940 --> 00:03:49.380
So there's this interesting article that was in the New York Times of all places that I'm picking

00:03:49.380 --> 00:03:52.420
it from called The Real Threat of Artificial Intelligence.

00:03:52.420 --> 00:03:59.360
And, you know, we so often hear people talk about AI and the singularity and super scary stuff.

00:03:59.360 --> 00:04:04.640
Like Elon Musk last year said that he's pretty sure that we live in a simulation, which I'm

00:04:04.640 --> 00:04:05.740
pretty sure is silly.

00:04:05.740 --> 00:04:07.080
What do you think about that?

00:04:07.080 --> 00:04:08.020
That's pretty silly.

00:04:08.160 --> 00:04:08.280
Yeah.

00:04:08.280 --> 00:04:10.840
I mean, it's a fun mind game to think.

00:04:10.840 --> 00:04:13.720
It's like a philosophy, you know, prove you exist sort of thing.

00:04:13.720 --> 00:04:15.460
But how real is it?

00:04:15.460 --> 00:04:17.180
And even if it is real, what can you do about it?

00:04:17.180 --> 00:04:17.440
Whatever.

00:04:17.440 --> 00:04:18.060
It doesn't matter.

00:04:18.820 --> 00:04:23.260
But this article kind of says, all right, let's look at really what the implications

00:04:23.260 --> 00:04:27.100
of AI for society are, right?

00:04:27.100 --> 00:04:33.040
So AI is going to be reshaping work and what jobs mean.

00:04:33.040 --> 00:04:39.280
And I'm not sure if it'll affect programming or not, whether AI will actually replace programmers

00:04:39.280 --> 00:04:41.000
or we'll just program AI.

00:04:41.000 --> 00:04:41.820
You know what I mean?

00:04:41.820 --> 00:04:43.980
Like we just might shift around a little bit.

00:04:43.980 --> 00:04:47.660
But if you do anything with AI, I recommend you check this out.

00:04:47.660 --> 00:04:51.040
It's really interesting on the effect that it's going to have on the industry, basically

00:04:51.040 --> 00:04:52.640
on society in general.

00:04:52.640 --> 00:04:58.720
And some of the things they said, well, like, you know, there's so many jobs that are going

00:04:58.720 --> 00:05:00.540
to be dramatically affected by this.

00:05:00.540 --> 00:05:04.360
Like I was just telling you before we started, like the number one job for men in the United

00:05:04.360 --> 00:05:05.180
States is driving.

00:05:05.180 --> 00:05:05.640
Yeah.

00:05:05.640 --> 00:05:11.600
And the combination between self-driving cars and self-driving trucks and the various other

00:05:11.600 --> 00:05:17.640
ways that automation is going to happen could easily take that down to very small

00:05:17.640 --> 00:05:19.060
percentage of what it is today.

00:05:19.060 --> 00:05:21.180
What's that going to mean for society?

00:05:21.180 --> 00:05:23.420
So these kinds of things are interesting to think about.

00:05:23.420 --> 00:05:29.400
The other part was sort of geopolitical, like how do countries sort of evolve with AI?

00:05:29.400 --> 00:05:35.260
So once there's an AI that can solve a problem, there's probably one that is way better than

00:05:35.260 --> 00:05:37.100
all the other attempts because they have more data.

00:05:37.100 --> 00:05:38.320
Think of Google, right?

00:05:38.320 --> 00:05:41.160
There are other search engines, but they don't come close to Google, right?

00:05:41.160 --> 00:05:41.700
For example.

00:05:42.380 --> 00:05:44.040
And it would probably be like that for AI.

00:05:44.040 --> 00:05:50.800
And so the countries that own the powerful AIs will be even more sort of unequal with the

00:05:50.800 --> 00:05:51.340
rest of the world.

00:05:51.340 --> 00:05:54.340
So if you're thinking about AI, you're doing AI and machine learning stuff.

00:05:54.340 --> 00:05:56.680
This is a really interesting philosophical read.

00:05:56.680 --> 00:05:57.140
Yeah.

00:05:57.140 --> 00:06:02.860
It's also not just the people with the AI, but also the people with the data sets that control

00:06:02.860 --> 00:06:03.620
the data sets.

00:06:03.620 --> 00:06:05.060
That's a huge part of it, right?

00:06:05.060 --> 00:06:05.400
Absolutely.

00:06:05.400 --> 00:06:09.360
Who's collecting the data now that can be fed to these AIs that make them stand out?

00:06:09.560 --> 00:06:09.800
Yeah.

00:06:09.800 --> 00:06:15.960
One of the things that I liked about this article was this kind of AI sometimes can seem still

00:06:15.960 --> 00:06:20.280
far out, even when we're trying to think about like driving cars and stuff.

00:06:20.280 --> 00:06:27.420
But the model that right now a use for AI is just any time where you take a whole bunch of

00:06:27.420 --> 00:06:33.320
data to use algorithms to decide on what decision for a particular circumstance.

00:06:34.160 --> 00:06:39.180
And like, for instance, all of the information about somebody that they turn in with their

00:06:39.180 --> 00:06:41.740
loan application, whether or not you should give them a loan.

00:06:41.740 --> 00:06:47.180
Well, I think it's going to be pretty fast if like a lot of loan representatives are replaced

00:06:47.180 --> 00:06:49.000
by AI machines.

00:06:49.000 --> 00:06:50.820
I can see that basically be instantaneous.

00:06:50.820 --> 00:06:51.360
Yeah.

00:06:51.360 --> 00:06:52.160
Here's my information.

00:06:52.160 --> 00:06:52.680
I want a loan.

00:06:52.680 --> 00:06:53.420
Okay, you can have it.

00:06:53.420 --> 00:06:54.140
No, you can't have it.

00:06:54.140 --> 00:06:54.660
Here's why.

00:06:54.660 --> 00:06:55.100
Yeah.

00:06:55.100 --> 00:06:55.460
You know what I mean?

00:06:55.740 --> 00:06:59.840
And also like first level, I mean, they even talked about customer service.

00:06:59.840 --> 00:07:05.480
And when we've got like voice recognition things going on that are pretty darn good.

00:07:05.620 --> 00:07:11.240
I mean, they're not great, but they're well enough to where your first level of contact

00:07:11.240 --> 00:07:15.800
through a phone service is probably going to be a computer not too long from now.

00:07:15.800 --> 00:07:16.120
Yeah.

00:07:16.120 --> 00:07:19.720
Certainly with all these like smart speaker type things, it's going to push that technology

00:07:19.720 --> 00:07:20.200
way out.

00:07:20.200 --> 00:07:26.760
And this article does have a bit of a dark view on the world, but just think of the stuff

00:07:26.760 --> 00:07:27.460
that AI can do.

00:07:27.460 --> 00:07:30.500
There's going to be a bunch of really amazing and positive stuff.

00:07:30.500 --> 00:07:35.140
Like one practical example, then we'll move on is shout out to the partially derivative

00:07:35.140 --> 00:07:37.860
guys, the other podcasts that I heard this on.

00:07:37.860 --> 00:07:44.720
They interviewed some people who are using data science and AI type stuff to make basically

00:07:44.720 --> 00:07:47.320
to solve police violence problems.

00:07:47.320 --> 00:07:55.580
And they said, if they use machine learning to figure out that if a policeman goes and handles

00:07:55.580 --> 00:08:00.920
like something terrible, like a suicide case, and then is immediately sent back out and

00:08:00.920 --> 00:08:05.340
pulls over somebody who talks back to them, there's a much higher chance of police violence

00:08:05.340 --> 00:08:09.200
against that driver because they're still upset from that previous thing.

00:08:09.200 --> 00:08:12.180
And so, you know, that was discovered through like data science and things like this.

00:08:12.180 --> 00:08:16.580
So there'll be a bunch of good stuff coming out of it, but some interesting effects on society

00:08:16.580 --> 00:08:17.320
and the jobs here.

00:08:17.320 --> 00:08:18.960
Anyway, it's something to keep track of.

00:08:18.960 --> 00:08:19.800
Yeah, it's nice.

00:08:19.800 --> 00:08:20.020
Yep.

00:08:20.020 --> 00:08:20.980
All right.

00:08:20.980 --> 00:08:26.440
So let's move from sort of society philosophy to the philosophy of physics and science applied

00:08:26.440 --> 00:08:27.040
to programming.

00:08:27.040 --> 00:08:31.240
There was an article called the three laws of config dynamics.

00:08:31.240 --> 00:08:34.980
And yes, that's config dynamics for like configuration files.

00:08:34.980 --> 00:08:38.360
And I ran into this recently myself.

00:08:38.360 --> 00:08:44.440
I've got, and they talk, the article starts out talking about how a project can like the inception

00:08:44.440 --> 00:08:47.020
of the birth of a configuration file for a project.

00:08:47.020 --> 00:08:53.240
And it often centers around something like what you're connected to, what database or

00:08:53.240 --> 00:08:56.800
what service you're connected to, and being able to control that.

00:08:56.800 --> 00:08:57.080
Right.

00:08:57.080 --> 00:09:00.760
Soon as you have like a dev database and a production database.

00:09:00.760 --> 00:09:01.160
Yeah.

00:09:01.160 --> 00:09:01.640
Then.

00:09:01.640 --> 00:09:02.020
Yeah.

00:09:02.020 --> 00:09:05.380
Like in the book I'm working on, I had a config file to control.

00:09:05.380 --> 00:09:08.180
It's a little task list application.

00:09:08.560 --> 00:09:11.920
And I support both Mongo and tiny DB.

00:09:11.920 --> 00:09:16.140
And so I have to tell the application which one to use and where it is.

00:09:16.140 --> 00:09:18.080
And those are things that just happen.

00:09:18.080 --> 00:09:22.900
But the article after come up with like how they're created in the first place talks

00:09:22.900 --> 00:09:24.000
about these three laws.

00:09:24.000 --> 00:09:30.500
And one of them was a config values can be transformed from one form to another, but can not be created

00:09:30.500 --> 00:09:31.420
or destroyed.

00:09:31.780 --> 00:09:37.200
And one of the examples of that is some people recommend putting the config values in environmental

00:09:37.200 --> 00:09:38.120
variables instead.

00:09:38.120 --> 00:09:43.000
But it just doesn't really solve the problem because people just create little scripts to,

00:09:43.000 --> 00:09:45.080
to write their environmental variables.

00:09:45.080 --> 00:09:47.340
And then now you've got a config file again.

00:09:47.580 --> 00:09:49.960
I love the parody to the three laws of thermodynamics.

00:09:49.960 --> 00:09:55.300
So the total length of config file can only increase over time.

00:09:55.300 --> 00:10:01.980
And I think that's just, if left unchecked, one of the recommendations there is to regularly

00:10:01.980 --> 00:10:08.160
evaluate your values in your config file and see if you can condense them or combine them

00:10:08.160 --> 00:10:09.280
or somehow limit them.

00:10:09.280 --> 00:10:09.520
Yeah.

00:10:09.520 --> 00:10:11.240
That's a really, that was a really interesting one.

00:10:11.240 --> 00:10:16.500
And I thought actually, you know, it was a good reminder that these things need maintenance

00:10:16.500 --> 00:10:21.180
and trimming and, and clean up just like the rest of your code or it can get nasty.

00:10:21.180 --> 00:10:26.400
And this one surprised me when I read it at first is the last one is a number three,

00:10:26.400 --> 00:10:32.200
the length of a perfect config file in a development environment is exactly equal to zero.

00:10:32.200 --> 00:10:37.600
And that's saying you should be able to run an application with no configuration file.

00:10:37.600 --> 00:10:43.880
And it should be like fairly valid because otherwise, if it isn't, then you've got to have some

00:10:43.880 --> 00:10:48.720
way to have each developer come up with what their default config file should be.

00:10:48.720 --> 00:10:49.080
Right.

00:10:49.080 --> 00:10:54.600
And so, you know, for example, you could have the dev database hard coded in, but if it's

00:10:54.600 --> 00:10:59.420
passed some other value, like a production or staging database, it'll just use that instead.

00:10:59.420 --> 00:11:01.800
So you don't need to specify the dev database.

00:11:01.800 --> 00:11:06.360
Similarly for like app on email, just go like, if there's nothing here, we just don't send email.

00:11:06.780 --> 00:11:10.540
But if there's something, we'll send it to this, you know, SMTP server and so on.

00:11:10.540 --> 00:11:10.940
Yeah.

00:11:10.940 --> 00:11:11.220
Yeah.

00:11:11.220 --> 00:11:14.360
And then it said, it also talked about Docker helping it.

00:11:14.360 --> 00:11:18.820
And since I'm not a Docker user, I just kind of got lost on that section.

00:11:18.820 --> 00:11:26.520
But yeah, I feel like, like we said before, Docker shifts programming experience to ops experience in a lot of ways.

00:11:26.620 --> 00:11:37.380
The way they said that Docker can help is with a Docker, you can consistently name the machines, the same thing in production and in development.

00:11:37.380 --> 00:11:38.220
And it's the same.

00:11:38.220 --> 00:11:40.260
So like the database server could just be called DB.

00:11:40.260 --> 00:11:44.240
The API address could just be API or whatever.

00:11:44.240 --> 00:11:48.420
And like you have different containers running in production versus development or whatever.

00:11:48.420 --> 00:11:48.980
Oh, okay.

00:11:48.980 --> 00:11:50.140
That makes sense.

00:11:50.140 --> 00:11:54.200
So you can hard code the name, but change the infrastructure to just match it.

00:11:54.200 --> 00:11:57.560
So I want to talk about Jupyter notebooks next.

00:11:57.560 --> 00:11:59.600
But before we do, let's talk about Rollbar.

00:11:59.600 --> 00:12:02.220
So Rollbar has been a longtime sponsor of the show.

00:12:02.220 --> 00:12:07.140
And I'm sure a lot of you know, right, the job of Rollbar is you integrate it into your app, especially web apps.

00:12:07.140 --> 00:12:09.700
If there's any kind of error, it gives you tons of information.

00:12:09.700 --> 00:12:12.500
So I'll touch on a few things that I haven't last time.

00:12:12.500 --> 00:12:16.560
So they support Python, of course, which is great.

00:12:16.560 --> 00:12:19.140
And, you know, that's why they're a big part of this community.

00:12:19.140 --> 00:12:22.900
But they actually support 26 languages and frameworks.

00:12:22.900 --> 00:12:26.740
So Python, but also Node, .NET, and they even support Flash.

00:12:26.740 --> 00:12:32.340
So if you want to get error handling your Flash apps that you somehow got stuck with, plug it in.

00:12:32.340 --> 00:12:36.480
And another thing that they have that's pretty cool is they have what's called people tracking.

00:12:36.480 --> 00:12:39.500
So if you have users, like anybody logged into your app,

00:12:39.500 --> 00:12:43.620
one of the problems is if somebody reports an error to you, they say,

00:12:43.620 --> 00:12:45.040
I did this thing and it didn't work.

00:12:45.040 --> 00:12:48.820
You're like, oh, gosh, I've got to go troll through the log files and find it, speaking of logging.

00:12:49.100 --> 00:12:53.700
But here with Rollbar, you can actually associate that error with a logged in user.

00:12:53.700 --> 00:13:02.000
And then you can go to your dashboard and say, find that user and see all the errors and workflow or flow through your app they ran into to find this error.

00:13:02.000 --> 00:13:03.100
So pretty cool.

00:13:03.100 --> 00:13:06.200
Check them out at pythonbytes.fm/Rollbar.

00:13:06.200 --> 00:13:08.040
It helps support the show and it's a cool product.

00:13:08.240 --> 00:13:22.720
Before we get on to Jupyter Notebooks, I have to say I just recently cleaned out my office and found my goodie bag from PyCon and found a Rollbar sticker and slapped it on my laptop because I'm really proud that Rollbar sponsors the show.

00:13:22.720 --> 00:13:23.600
That's awesome.

00:13:23.600 --> 00:13:24.880
Very, very cool.

00:13:24.880 --> 00:13:25.140
Yeah.

00:13:25.140 --> 00:13:28.000
My Rollbar t-shirt is quite threadbare these days.

00:13:28.360 --> 00:13:28.800
Okay.

00:13:28.800 --> 00:13:32.880
So let's talk about five tips for getting started with Jupyter Notebooks.

00:13:32.880 --> 00:13:34.960
How are you with Jupyter Notebooks?

00:13:34.960 --> 00:13:35.700
Do you use them often?

00:13:35.700 --> 00:13:36.260
No.

00:13:36.260 --> 00:13:37.060
Yeah, I don't either.

00:13:37.060 --> 00:13:41.160
I mean, mostly I do web stuff with tons of files and like they all got to fit together.

00:13:41.160 --> 00:13:44.080
So the workflow is just not that way for me.

00:13:44.080 --> 00:13:50.120
I also often feel like, you know, I should really just get in the habit of firing up a Jupyter Notebook for certain types of work.

00:13:50.120 --> 00:13:59.880
And so this is a nice little article, I think is by the ActiveState folks, about a couple of things you can do to just like start really quickly and easily with Jupyter Notebooks.

00:13:59.880 --> 00:14:04.620
So the five tips are don't put your entire code into a single cell, right?

00:14:04.620 --> 00:14:08.180
You have these little cells, you put little fragments of code and the cells like work together.

00:14:08.180 --> 00:14:10.420
So you get the output of each step.

00:14:10.420 --> 00:14:15.220
So if you break it apart, right, you get kind of, you can execute the steps independently.

00:14:15.220 --> 00:14:17.240
You can have the data flow from one to the next.

00:14:17.240 --> 00:14:17.700
That's cool.

00:14:17.700 --> 00:14:19.320
There's different types of cells.

00:14:19.320 --> 00:14:24.100
Like you can put markdown or you can put Python code or you can put a picture, all kinds of stuff.

00:14:24.100 --> 00:14:26.420
So you can kind of build up a story with a code.

00:14:26.420 --> 00:14:29.620
You can execute shells with shift enter.

00:14:29.620 --> 00:14:31.700
This is not the ActiveState guys.

00:14:31.700 --> 00:14:33.820
This is Esri, ESRI.

00:14:33.820 --> 00:14:39.020
Anyway, you can explore like maps because you can integrate their ArcGIS stuff into it.

00:14:39.020 --> 00:14:43.360
And they have a really cool way to get information about modules you might not know about.

00:14:43.360 --> 00:14:49.200
So you could type, say, like import Daiquiri and then Daiquiri question mark and hit tab.

00:14:49.200 --> 00:14:51.680
And it'll like give you a big summary of what you can do with Daiquiri.

00:14:51.680 --> 00:14:52.140
Oh, wow.

00:14:52.140 --> 00:14:52.480
Cool.

00:14:52.560 --> 00:14:55.280
Anyway, there's a few simple things you do with Jupyter.

00:14:55.280 --> 00:14:59.320
Hopefully this inspires you to check it out and try it for when it makes sense.

00:14:59.320 --> 00:14:59.980
All right.

00:14:59.980 --> 00:15:01.240
What's next?

00:15:01.240 --> 00:15:02.320
Oh, coupling.

00:15:02.320 --> 00:15:03.460
Coupling versus decoupling.

00:15:03.460 --> 00:15:04.280
Tell me about coupling.

00:15:04.280 --> 00:15:05.500
Coupling versus decoupling.

00:15:05.500 --> 00:15:08.380
So this is an article by Kent Beck.

00:15:08.380 --> 00:15:14.500
And I've followed Kent Beck since I was reading about extreme programming and test-driven development.

00:15:14.500 --> 00:15:14.760
Yeah.

00:15:14.820 --> 00:15:21.700
He's one of the original agile manifesto guys, the extreme programming, pair programming, all that stuff from back in the day, right?

00:15:21.700 --> 00:15:21.900
Yeah.

00:15:21.900 --> 00:15:25.100
And I ran across this article and I was confused.

00:15:25.100 --> 00:15:26.420
At first I was confused.

00:15:26.420 --> 00:15:29.500
It's called cost of coupling versus cost of decoupling.

00:15:29.960 --> 00:15:34.640
And I'm like, why is he writing on like posting this on Facebook?

00:15:34.640 --> 00:15:36.380
But he works at Facebook.

00:15:36.380 --> 00:15:37.580
So that makes sense.

00:15:37.580 --> 00:15:42.060
So anyway, two elements are coupled with respect to a given change.

00:15:42.060 --> 00:15:45.720
If the change, changing one element implies changing the other.

00:15:45.720 --> 00:15:47.180
So that makes sense for coupling.

00:15:47.180 --> 00:15:55.180
So when you're writing tightly coupled code, it's hard to change things because things, every time you change one thing, you got to change a bunch.

00:15:55.340 --> 00:16:00.500
Like if you've got, if you do copy and paste coding all over the place, then if you fix the algorithm, you got to fix it everywhere.

00:16:00.500 --> 00:16:08.300
The other thing, other places where coupling often creeps up is very tightly coupled test and implementation.

00:16:08.300 --> 00:16:15.260
So if you, with mocks and whatever, and if you, if you decide to change, change part of the design, you got to change all the tests.

00:16:15.260 --> 00:16:18.420
So some people are okay with that, whatever.

00:16:18.420 --> 00:16:21.920
But, and decoupled code is the opposite of that.

00:16:21.920 --> 00:16:25.000
It follows the dry principle and uses smaller components or whatever.

00:16:25.000 --> 00:16:32.420
But the nice decoupled code also takes more time to write and design initially.

00:16:32.420 --> 00:16:42.140
So the article is just talking about thinking about the costs of both and making sure and understanding that there are places for both of them in your development.

00:16:42.140 --> 00:16:45.760
And Kent splits it into explore and extract.

00:16:45.760 --> 00:16:51.620
And that's, maybe those words are more meaningful to him, but that isn't very obvious to me.

00:16:51.940 --> 00:16:59.180
So the explore phase being like a spike projects or your first draft of your implementation or happy path.

00:16:59.360 --> 00:17:06.520
The point of that, your first writing through a project is just learning about it, answering questions quickly and,

00:17:06.520 --> 00:17:13.460
and learning enough about the, whatever you're working in to, to ask better questions as you go along.

00:17:13.460 --> 00:17:18.440
And then the extract phase is more like a final draft or architected stuff.

00:17:18.440 --> 00:17:24.400
Economies of scale take over and you need to minimize the cost of changes so that you can,

00:17:24.460 --> 00:17:26.800
you know, you know, the opposite of that.

00:17:26.800 --> 00:17:28.500
Yeah.

00:17:28.500 --> 00:17:32.200
Well, I think one of the things that's interesting about this is, you know, it's,

00:17:32.200 --> 00:17:37.040
it's easy to like study design patterns or these types of things and say,

00:17:37.040 --> 00:17:39.560
Oh, I'm going to apply this to like everything I do from now.

00:17:39.560 --> 00:17:40.360
Cause this is amazing.

00:17:40.820 --> 00:17:47.500
But if you're building something that's 5,000 lines and is like, just, you are going to work on it.

00:17:47.500 --> 00:17:54.220
You're just going to be spending extra effort to make these, to apply these patterns and this decoupling and whatnot.

00:17:54.220 --> 00:17:57.560
When you could just write it and be done.

00:17:57.560 --> 00:18:04.140
Whereas if a team of 10 people is working on it and it's a hundred thousand lines and it's got to live a long time and be maintainable and evolve.

00:18:04.340 --> 00:18:06.920
Well then, you know, these things make a lot more sense, right?

00:18:06.920 --> 00:18:08.660
So definitely think about the trade-offs.

00:18:08.660 --> 00:18:08.960
Yeah.

00:18:08.960 --> 00:18:17.780
And also as you're like a more, as your project goes into maturity, the code base is going to get larger and it's going to cover a little corner cases.

00:18:17.780 --> 00:18:27.360
So it is necessarily going to be your tests are going to cover those little corner cases and they're going to be more tightly coupled as well.

00:18:27.360 --> 00:18:34.540
So it was a good to think about and to make sure that you okay with hacking things together at first, if, if you're learning stuff.

00:18:34.540 --> 00:18:34.760
Yeah.

00:18:34.760 --> 00:18:36.740
Sometimes it's worth it just to hack it together.

00:18:36.740 --> 00:18:37.500
All right.

00:18:37.500 --> 00:18:41.000
Last one for me is just an inspirational little project.

00:18:41.000 --> 00:18:46.020
Something a lot of people out there ask me like, Hey Michael, I want to get started in programming in Python.

00:18:46.360 --> 00:18:55.680
I want to build up some kind of portfolio that I could show people to get a job or to get a promotion or whatever.

00:18:55.680 --> 00:18:56.020
Right.

00:18:56.020 --> 00:19:03.080
So the guy who was over at PyBytes, not Python bytes, PyBytes, P-Y-B-I-T-E-S.

00:19:03.080 --> 00:19:04.940
That's Bob and Julian.

00:19:04.940 --> 00:19:08.940
You can see the link in the site, the show notes.

00:19:08.940 --> 00:19:11.920
They did a hundred days of code challenge.

00:19:11.920 --> 00:19:12.620
Have you heard of this, Brian?

00:19:12.620 --> 00:19:15.260
Well, I've been sort of following them along with this.

00:19:15.260 --> 00:19:26.140
They're pretty good at giving information about what they're up to because they had part of their challenge was they wrote a bot that would automatically tweet the process, their progress each day.

00:19:26.140 --> 00:19:27.060
And there's a hundred days.

00:19:27.060 --> 00:19:29.300
So they were just going after it.

00:19:29.300 --> 00:19:33.140
One of the things I wasn't clear on, did they start the hundred days of code or did they?

00:19:33.140 --> 00:19:35.360
I don't think they started it.

00:19:35.360 --> 00:19:37.100
I think they said, we're going to do it for Python.

00:19:37.220 --> 00:19:37.340
Okay.

00:19:37.340 --> 00:19:37.840
Yeah.

00:19:37.840 --> 00:19:41.960
And so they wrote, they found out they have all sorts of stats and pictures and stuff.

00:19:41.960 --> 00:19:44.440
So the article, the writeup that we're referencing is really cool.

00:19:44.440 --> 00:19:49.880
They wrote about 5,000 lines of code split across obviously 100 scripts per day.

00:19:50.760 --> 00:19:55.860
And the number of lines was like between 50 and 200 per day, which is kind of an interesting thing.

00:19:55.860 --> 00:19:57.080
They've got a whole bunch of projects.

00:19:57.080 --> 00:20:00.460
They've got 10 projects that they built that they showcased.

00:20:00.460 --> 00:20:02.540
And they're really, some of them are really neat.

00:20:02.540 --> 00:20:05.900
Like I said, they auto tweeted their progress.

00:20:06.840 --> 00:20:12.540
They ran some stuff, some analysis across their scripts, their 100 scripts and figured out they

00:20:12.540 --> 00:20:14.600
used exactly 100 modules.

00:20:14.600 --> 00:20:15.440
Wow.

00:20:15.440 --> 00:20:16.880
So weird coincidence, right?

00:20:16.880 --> 00:20:19.220
So a hundred different modules as part of it.

00:20:19.220 --> 00:20:22.960
And their next a hundred day project is going to be around Django.

00:20:22.960 --> 00:20:27.980
So if you're interested in Django, you know, follow them on Twitter or however they send out

00:20:27.980 --> 00:20:29.460
their messages and about this stuff.

00:20:29.460 --> 00:20:33.880
But anyway, if you're interested in like getting started, check out their article.

00:20:34.160 --> 00:20:39.680
It may help you have some concrete things, small concrete daily things you can do.

00:20:39.680 --> 00:20:42.440
And a hundred days later, you'll have a lot more experience.

00:20:42.440 --> 00:20:42.780
Yeah.

00:20:42.780 --> 00:20:44.620
I think it was Bob that was at PyCon.

00:20:44.620 --> 00:20:45.220
Yes.

00:20:45.220 --> 00:20:45.500
Yeah.

00:20:45.500 --> 00:20:49.220
I ran into Bob and talked with him a little bit and great guy.

00:20:49.220 --> 00:20:50.940
And I just, I like what they're doing.

00:20:50.940 --> 00:20:55.140
They have like one person, I can't remember who, which is which, but one of them already

00:20:55.140 --> 00:20:56.380
knew Python to begin with.

00:20:56.380 --> 00:21:01.140
And the other one was like brand new, had never used Python before as they, as they started

00:21:01.140 --> 00:21:02.340
the PyBytes thing.

00:21:02.340 --> 00:21:03.380
So yeah.

00:21:03.380 --> 00:21:04.020
Very, very cool.

00:21:04.400 --> 00:21:04.660
All right.

00:21:04.660 --> 00:21:05.480
What else you got for us?

00:21:05.480 --> 00:21:06.580
That's, that's our news for the week.

00:21:06.580 --> 00:21:07.600
What's up with you?

00:21:07.600 --> 00:21:08.840
Good review of your book, right?

00:21:08.840 --> 00:21:09.420
I just read it.

00:21:09.420 --> 00:21:09.820
Yeah.

00:21:09.820 --> 00:21:16.240
I ran across the first review I've seen so far for the book by Chris Shaver and well, the

00:21:16.240 --> 00:21:20.660
link in the show notes, but it was nice to see a book review of it.

00:21:20.660 --> 00:21:23.700
And it's fun to have more and more people reading it.

00:21:23.700 --> 00:21:24.600
So it's good.

00:21:24.600 --> 00:21:25.000
Yeah.

00:21:25.100 --> 00:21:29.860
It was really a good write-up and summarized it well and gave it a good vote of confidence.

00:21:29.860 --> 00:21:31.200
So I think it's well-deserved.

00:21:31.200 --> 00:21:31.540
Nice.

00:21:31.540 --> 00:21:32.080
How about you?

00:21:32.080 --> 00:21:41.560
Finally, after a very long time, long journey, kind of book-like duration, the Python for Entrepreneurs

00:21:41.560 --> 00:21:46.340
course has finally officially been finished and is ready to go.

00:21:46.340 --> 00:21:52.380
So it's came in around 19 hours of content and you get it at talkpython.fm/launch.

00:21:52.380 --> 00:21:55.440
So I'm super excited to be done with that course.

00:21:55.440 --> 00:21:58.060
It came out great and move on to writing new courses.

00:21:58.060 --> 00:21:58.600
Awesome.

00:21:58.820 --> 00:21:58.940
Yeah.

00:21:58.940 --> 00:22:03.680
It took so long, I actually wrote two other courses and finished them while that was getting

00:22:03.680 --> 00:22:04.080
finished.

00:22:04.080 --> 00:22:07.240
Well, would that have been faster?

00:22:07.240 --> 00:22:08.640
Had you focused on one?

00:22:08.640 --> 00:22:10.600
No, because I was waiting on other people.

00:22:10.600 --> 00:22:11.480
I was waiting on editors.

00:22:11.480 --> 00:22:13.420
I was waiting on Matt to do his sections.

00:22:13.420 --> 00:22:17.500
I was waiting on PyCharm to fix a bug so I could finish another second.

00:22:17.500 --> 00:22:18.780
There's just like lots of waiting.

00:22:18.780 --> 00:22:20.080
So many things.

00:22:20.080 --> 00:22:20.880
Okay.

00:22:20.880 --> 00:22:21.660
But it's all good.

00:22:21.660 --> 00:22:22.180
It's all done.

00:22:22.180 --> 00:22:22.640
Wonderful.

00:22:22.640 --> 00:22:23.020
All right.

00:22:23.020 --> 00:22:23.580
Yeah.

00:22:23.580 --> 00:22:26.300
So good to see our projects getting out to the world.

00:22:26.300 --> 00:22:28.140
Well, thanks again for talking with me this week.

00:22:28.140 --> 00:22:28.560
You bet.

00:22:28.560 --> 00:22:29.680
And thank you everyone for listening.

00:22:29.680 --> 00:22:30.720
See you next time.

00:22:30.720 --> 00:22:31.160
Bye, Brian.

00:22:31.160 --> 00:22:31.400
Bye.

00:22:31.400 --> 00:22:34.060
Thank you for listening to Python Bytes.

00:22:34.060 --> 00:22:36.620
Follow the show on Twitter via at Python Bytes.

00:22:36.620 --> 00:22:39.520
That's Python Bytes as in B-Y-T-E-S.

00:22:39.520 --> 00:22:42.920
And get the full show notes at pythonbytes.fm.

00:22:42.920 --> 00:22:47.280
If you have a news item you want featured, just visit pythonbytes.fm and send it our way.

00:22:47.280 --> 00:22:49.980
We're always on the lookout for sharing something cool.

00:22:49.980 --> 00:22:53.360
On behalf of myself and Brian Okken, this is Michael Kennedy.

00:22:53.360 --> 00:22:56.980
Thank you for listening and sharing this podcast with your friends and colleagues.

