WEBVTT

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

00:00:05.540 --> 00:00:10.080
This is episode 49, recorded October 24th, 2017.

00:00:10.080 --> 00:00:11.240
I'm Michael Kennedy.

00:00:11.240 --> 00:00:12.140
And I'm Brian Okken.

00:00:12.140 --> 00:00:18.480
And we have yet another six or more amazing news items, actually tons of really cool stuff to share with you.

00:00:18.480 --> 00:00:26.180
But before we get to them, I want to say thanks to DigitalOcean for creating spaces and sponsoring this podcast to tell you about spaces.

00:00:26.180 --> 00:00:28.820
Spaces are like S3, but way, way better.

00:00:29.380 --> 00:00:32.540
And check them out at do.co slash Python.

00:00:32.540 --> 00:00:33.920
Tell you more about that later.

00:00:33.920 --> 00:00:35.580
Right now, I want to go watching some videos.

00:00:35.580 --> 00:00:39.040
Yeah, I know there's a lot of conferences that go on around the world.

00:00:39.040 --> 00:00:45.040
And actually, anybody that's doing a Python conference, I have no problem with trying to highlight those.

00:00:45.040 --> 00:00:48.720
So let us know when they're going on and also when their videos are up.

00:00:48.720 --> 00:00:53.820
And that's what I want to talk about right now is there's a couple conferences who have videos available now.

00:00:54.780 --> 00:00:57.800
DjangoCon and PyGotham both happened recently.

00:00:57.800 --> 00:00:59.520
And both of their videos are available.

00:00:59.880 --> 00:01:01.420
So we've got links to both.

00:01:01.420 --> 00:01:02.840
PyGotham is on.

00:01:02.840 --> 00:01:08.060
Yeah, I don't know if it's on YouTube or not, but it is up on pyvideo.org.

00:01:08.060 --> 00:01:11.640
And the DjangoCon 2017 is up on YouTube.

00:01:11.640 --> 00:01:14.060
And I've got links to both those playlists.

00:01:14.540 --> 00:01:17.780
I was excited to look at a lot of these.

00:01:17.780 --> 00:01:24.100
And one of the videos I started off with was a video from DjangoCon called Django vs. Flask.

00:01:24.100 --> 00:01:27.220
And it was by DB David Baumgold.

00:01:27.220 --> 00:01:27.980
That sounds fun.

00:01:28.240 --> 00:01:33.180
It actually was interesting because it's somebody that respects both Django and Flask.

00:01:33.180 --> 00:01:40.780
And it was probably one of the best Flask videos I've watched talking about how to deal,

00:01:40.780 --> 00:01:44.580
kind of how to do some of the things you can do in Django right out of the box,

00:01:44.580 --> 00:01:47.300
but how to do it in Flask and comparing those.

00:01:47.300 --> 00:01:47.800
It was cool.

00:01:47.800 --> 00:01:49.260
That sounds like a really cool video.

00:01:49.260 --> 00:01:51.580
It's one thing to go study Django.

00:01:51.580 --> 00:01:53.140
It's one thing to learn Flask.

00:01:53.140 --> 00:01:56.840
But to see the features side by side sounds like a really nice way to...

00:01:56.840 --> 00:01:59.940
If you're new and you're trying to decide, should I go with Flask or should I go with Django?

00:01:59.940 --> 00:02:02.920
This is like half an hour, 45 minutes.

00:02:02.920 --> 00:02:08.220
You'll have probably a really good idea rather than you've got to like spend hours learning each and then decide, right?

00:02:08.220 --> 00:02:09.600
It sounds like he leans.

00:02:09.600 --> 00:02:11.720
He likes the flexibility of Flask.

00:02:11.720 --> 00:02:15.160
However, it's obvious that he has respect for both.

00:02:15.160 --> 00:02:18.580
And he's talking at a Django conference, of course.

00:02:18.580 --> 00:02:21.120
There's some things I didn't even know about, which was cool.

00:02:21.120 --> 00:02:23.120
I didn't know about Flask blueprints.

00:02:23.120 --> 00:02:27.420
And I also definitely never heard of Flask Marshmallow for APIs before.

00:02:27.420 --> 00:02:28.880
Marshmallow.

00:02:28.880 --> 00:02:29.640
Yeah, that's great.

00:02:29.640 --> 00:02:36.860
And it covers things like SQLAlchemy, MongoEngine, PeeWee, all the great ODM, ORM data access layers.

00:02:36.860 --> 00:02:37.400
It's cool.

00:02:37.400 --> 00:02:37.740
Yeah.

00:02:37.740 --> 00:02:41.520
But there's so many other great videos up from those two conferences.

00:02:41.520 --> 00:02:42.860
And I really appreciate that.

00:02:42.860 --> 00:02:48.020
That part of the Python culture that we try to make the conference videos available for people.

00:02:48.020 --> 00:02:48.620
Yeah, that's great.

00:02:48.620 --> 00:02:52.140
I love that these conferences are so quick about getting the videos up.

00:02:52.240 --> 00:02:54.320
The videos are really high quality usually.

00:02:54.320 --> 00:02:56.000
The sound is good.

00:02:56.000 --> 00:02:57.340
Everything's in focus.

00:02:57.340 --> 00:02:58.720
A lot of times it's picture in picture.

00:02:58.720 --> 00:02:59.680
I mean, well done.

00:02:59.680 --> 00:03:00.620
So that's nice.

00:03:00.620 --> 00:03:01.600
What do you got for us, Michael?

00:03:01.600 --> 00:03:04.820
Well, I want to pay a little attention to Facebook.

00:03:04.820 --> 00:03:07.260
Because Facebook does a lot with Python, actually.

00:03:07.260 --> 00:03:09.980
People will tell you Facebook is written in PHP.

00:03:10.820 --> 00:03:14.980
And that it uses React, the JavaScript framework, which they invented on the front end.

00:03:14.980 --> 00:03:16.280
So it's like PHP plus React.

00:03:16.280 --> 00:03:17.200
And that's interesting.

00:03:17.200 --> 00:03:19.560
But it turns out that I don't work there.

00:03:19.560 --> 00:03:20.900
I don't really know a lot of people there.

00:03:20.900 --> 00:03:29.020
But from what I've been able to read, there's a decent amount of Python backend services sort of supporting that PHP front end.

00:03:29.540 --> 00:03:29.780
Okay.

00:03:29.780 --> 00:03:30.100
Wow.

00:03:30.100 --> 00:03:30.560
Yeah.

00:03:30.560 --> 00:03:31.460
And so that's pretty cool.

00:03:31.460 --> 00:03:35.300
And there was a tweet from one of the guys there, L Lange.

00:03:35.300 --> 00:03:36.920
I think he works there.

00:03:36.920 --> 00:03:39.180
I'm pretty sure he works there from the reading of the tweet.

00:03:39.180 --> 00:03:44.780
But he was talking about Facebook and said, hey, Python 363 was released on Tuesday.

00:03:44.780 --> 00:03:48.260
And I think last Tuesday you covered that, which is pretty awesome.

00:03:48.260 --> 00:03:50.860
This was, maybe this was two weeks ago.

00:03:51.000 --> 00:03:54.440
When it was released, though, they said this tweet was three days after that.

00:03:54.440 --> 00:03:58.120
And it said, all the machines at Facebook are already running Python 363.

00:03:58.120 --> 00:03:58.620
That's cool.

00:03:58.620 --> 00:03:59.200
Three days.

00:03:59.200 --> 00:04:07.280
And they said that 36.3% of their Python apps are based on 36 already.

00:04:07.280 --> 00:04:08.260
How about that?

00:04:08.260 --> 00:04:09.000
That's great.

00:04:09.000 --> 00:04:10.860
Man, I love 36 now.

00:04:10.860 --> 00:04:11.360
I do too.

00:04:11.360 --> 00:04:13.180
The f-strings are just so delightful.

00:04:13.180 --> 00:04:14.520
Yeah.

00:04:14.520 --> 00:04:16.200
And so this is super interesting.

00:04:16.200 --> 00:04:19.460
And what's more interesting is I would say 20.

00:04:20.400 --> 00:04:21.540
Oh, gosh, I'm forgetting the numbers.

00:04:21.540 --> 00:04:25.360
I'll have to just send you guys to the video and let you pull the numbers out.

00:04:25.360 --> 00:04:29.780
But a couple years previously, Facebook was not friendly to Python 3.

00:04:29.780 --> 00:04:34.400
Basically, they had just gotten access to Python 2.7 from 2.6.

00:04:34.400 --> 00:04:36.360
Okay, that was the big upgrade.

00:04:36.360 --> 00:04:40.940
And all the recommendations were to use Python 2.

00:04:40.940 --> 00:04:46.040
The onboarding processes said, hey, when you get here, you're expected to write in Python 2,

00:04:46.040 --> 00:04:46.860
et cetera, et cetera.

00:04:47.500 --> 00:04:52.840
And this guy named Jason Fried, not of 37 Signals fame, but a different Jason Fried,

00:04:52.840 --> 00:05:01.560
took over the process of trying to shift the organizational culture to valuing Python 3 as the default

00:05:01.560 --> 00:05:05.100
and making the people that do Python 2 look kind of outdated and funky.

00:05:05.580 --> 00:05:10.800
So there's this really great presentation called Rules for Radicals, Changing the Culture of Python at Facebook.

00:05:10.800 --> 00:05:13.320
And it's step by step.

00:05:13.320 --> 00:05:21.040
It's a step by step playbook, basically, of how he transformed the culture to where we're in this place

00:05:21.040 --> 00:05:24.380
where you say Python 3.6.3 was released on Tuesday.

00:05:24.920 --> 00:05:26.740
Facebook machines are now running it.

00:05:26.740 --> 00:05:28.400
And that tweet comes out on Friday, right?

00:05:28.400 --> 00:05:32.900
So this is not like, well, Facebook's a startup.

00:05:32.900 --> 00:05:33.840
It can always do like.

00:05:33.840 --> 00:05:39.840
No, it was this huge organization transformed through clear, simple, repeatable steps.

00:05:39.840 --> 00:05:43.960
So I think this is just a really cool evidence of Jason Fried's work.

00:05:43.960 --> 00:05:45.780
And well done, Jason, and everyone at Facebook.

00:05:45.780 --> 00:05:47.380
Yeah, and I can't wait to watch this video.

00:05:47.380 --> 00:05:48.660
Thanks for linking to it.

00:05:48.760 --> 00:05:49.760
Yeah, yeah, it's super cool.

00:05:49.760 --> 00:05:52.000
It was at PyOhio a couple years ago.

00:05:52.000 --> 00:05:57.840
And in more modern Python news, Ubuntu 17.10, which just came out,

00:05:57.840 --> 00:06:00.640
and I upgraded one of my servers recently to it.

00:06:00.640 --> 00:06:07.280
It says Python 2 is no longer installed by default, and Python 3.6 has been upgraded to 3.6.

00:06:07.280 --> 00:06:08.180
How about that?

00:06:08.180 --> 00:06:08.780
That's great.

00:06:08.780 --> 00:06:10.100
Another step forward.

00:06:10.100 --> 00:06:12.660
All right, so modern Python is on the march.

00:06:12.660 --> 00:06:16.720
And 3.3 is end of life, probably by the time this comes out.

00:06:16.720 --> 00:06:17.700
It's already end of life.

00:06:17.860 --> 00:06:21.060
So if you have something on 3.3, it is time to move up.

00:06:21.060 --> 00:06:23.440
And if you're going to move up, don't go to 3.4, go to 3.6.

00:06:23.440 --> 00:06:28.940
Speaking of new technologies, there was a pretty good article, and it's not Python specific,

00:06:28.940 --> 00:06:32.380
but called Your Technical Skills Are Obsolete, Now What?

00:06:32.380 --> 00:06:38.460
And this is, it's actually a pretty fun article about, you know, since you and I are both big

00:06:38.460 --> 00:06:42.800
proponents to people keeping their skills up to date and learning new things, I thought

00:06:42.800 --> 00:06:43.780
it fit in nice.

00:06:44.180 --> 00:06:50.160
And this article is focused on how to do that while at work, to not try to eat into

00:06:50.160 --> 00:06:53.120
your home life to beef up your skills.

00:06:53.120 --> 00:06:57.840
I think there's a lot of people who feel kind of in a tough situation because they see all

00:06:57.840 --> 00:07:03.360
these new technologies coming out, and they hear presentations or people say, oh, the stuff

00:07:03.360 --> 00:07:04.660
that you do is so old and crappy.

00:07:04.660 --> 00:07:07.620
You should be doing whatever whiz-bang new thing it is.

00:07:07.840 --> 00:07:12.180
These recommendations or this excitement, probably rightly so, but it comes from people who

00:07:12.180 --> 00:07:13.120
are young.

00:07:13.120 --> 00:07:17.040
Maybe they don't have kids or they're single and they have a lot of free time.

00:07:17.040 --> 00:07:22.280
And to spend an extra two hours after work on some project is like no big deal if you're

00:07:22.280 --> 00:07:24.660
young and you've got lots of free time and energy.

00:07:24.660 --> 00:07:29.720
But if you're getting dinner for the kids and you've been up early driving to school and you've

00:07:29.720 --> 00:07:32.560
got to work with homework, it's just like, it's a whole nother level, right?

00:07:32.560 --> 00:07:36.540
I think it's a great idea to try to fit that into your work if you can.

00:07:36.540 --> 00:07:42.080
One of the things is I really like that he starts off by talking about the reasons, sometimes

00:07:42.080 --> 00:07:45.440
good reasons why companies stay with an old technology.

00:07:45.440 --> 00:07:50.380
However, I mean, if Facebook can switch in a few days, what's your company's excuse?

00:07:50.380 --> 00:07:51.700
That's right.

00:07:51.700 --> 00:07:56.620
Seriously, though, sometimes there's good reasons to not jump on the bandwagon right away.

00:07:56.620 --> 00:08:02.400
So he goes through some steps of identifying obsolete and problematic technologies and

00:08:02.400 --> 00:08:07.740
trying to do some research on potential replacements and then trying to get buy-in from your management

00:08:07.740 --> 00:08:14.440
and hopefully to try to get some time for yourself or maybe you and some other people to do a pilot

00:08:14.440 --> 00:08:16.660
project exploring this process.

00:08:16.660 --> 00:08:16.940
Yeah.

00:08:16.940 --> 00:08:22.620
The main message of this was, look, if you want to find a way to learn new skills, you need

00:08:22.620 --> 00:08:25.000
to fit it into work often, right?

00:08:25.000 --> 00:08:28.680
Unless you just want to really put in a lot of energy to learn something outside of work.

00:08:28.680 --> 00:08:33.780
But if you're going to try to fit into work, go and identify a problematic area of your technology

00:08:33.780 --> 00:08:41.500
stack and see, like create a plan on how to solve that problem with the new technology by

00:08:41.500 --> 00:08:41.900
you.

00:08:41.900 --> 00:08:44.820
Thereby, you learn the new technology by solving the problem.

00:08:44.820 --> 00:08:47.780
So you're actually adding value, not just saying, please send me to training.

00:08:47.780 --> 00:08:50.380
You didn't sit me in six weeks or six months, whatever, right?

00:08:50.560 --> 00:08:56.180
So then he does talk about how to pose those questions and talk to your manager about making

00:08:56.180 --> 00:08:56.840
the change.

00:08:56.840 --> 00:09:02.280
But he kind of ends with, if your boss says no, then you at least have some extra skills

00:09:02.280 --> 00:09:03.780
that you can apply to your next job.

00:09:03.780 --> 00:09:10.040
And I'd like to shim in there and say, I think you should use it to start a conversation with

00:09:10.040 --> 00:09:15.460
your boss or your management chain about that you care about the company, you care about increasing

00:09:15.460 --> 00:09:18.100
the skills of both yourself and the others on your team.

00:09:18.100 --> 00:09:21.000
And how can you go about doing that?

00:09:21.000 --> 00:09:21.520
And why?

00:09:21.520 --> 00:09:22.340
Why the no?

00:09:22.340 --> 00:09:27.940
Like, is it bad timing or you just have a bad proposal or too much time spent?

00:09:27.940 --> 00:09:33.080
Anyway, I think that you should try to not throw your company under the bus right away and

00:09:33.080 --> 00:09:34.140
try to work a little harder.

00:09:34.840 --> 00:09:41.260
So I think actually your, the video you linked to with the rules for radicals probably fits

00:09:41.260 --> 00:09:43.800
right in here too, of trying to change your company.

00:09:43.800 --> 00:09:44.420
Yeah, absolutely.

00:09:44.420 --> 00:09:47.400
You don't just like Jason didn't just go, well, I said Python too.

00:09:47.400 --> 00:09:48.440
So I'm going to go find a startup.

00:09:48.440 --> 00:09:49.320
Forget this, right?

00:09:49.320 --> 00:09:52.160
He, he actually changed Facebook, which is even more impressive.

00:09:52.160 --> 00:09:56.160
And then a book that a little tiny, it's a little tiny read, a book I read a couple of

00:09:56.160 --> 00:10:00.660
years ago is called Team Geek that has some great advice on this.

00:10:00.660 --> 00:10:06.880
And it says that things like changing your process, you probably ought to limit it to under

00:10:06.880 --> 00:10:08.160
50% of your time.

00:10:08.160 --> 00:10:09.840
I would say stronger.

00:10:09.840 --> 00:10:13.960
I would say 10 to 20% of your time at most trying to fix things.

00:10:13.960 --> 00:10:20.240
And then the other thing is there's a nice section on, sometimes it's easier to ask for forgiveness

00:10:20.240 --> 00:10:21.060
than permission.

00:10:21.340 --> 00:10:25.760
You can try to get your manager buy-in, but also if you're not spending much time on it,

00:10:25.760 --> 00:10:28.260
you might be able to just change some things and make it better.

00:10:28.260 --> 00:10:33.840
Like one of those disclaimers, this, my advice cannot be taken as legal advice and you should

00:10:33.840 --> 00:10:35.620
seek your own legal counsel, but.

00:10:35.620 --> 00:10:39.020
Yeah, your conditions may vary, but I think this is good.

00:10:39.020 --> 00:10:40.180
I think it's really good advice.

00:10:40.180 --> 00:10:44.340
And this article is really practical, especially for people who are not trying to spend an extra

00:10:44.340 --> 00:10:46.480
hour a day outside of work learning something.

00:10:46.480 --> 00:10:48.140
So that's really cool.

00:10:48.140 --> 00:10:52.860
I feel like there's a lot of slack in big organizations already.

00:10:52.860 --> 00:10:55.120
You get put into a lot of meetings.

00:10:55.120 --> 00:11:01.120
You have a lot of, I don't know, there's time between the actual work that seems to get done.

00:11:01.120 --> 00:11:06.120
And if you can just wall off like a little bit of that for learning and working on a project,

00:11:06.120 --> 00:11:08.480
it could be like a skunk work thing.

00:11:08.560 --> 00:11:11.080
I'm trying to prototype something different or I'm just learning something.

00:11:11.080 --> 00:11:16.540
But if you could like, say, find an extra half hour a day to be studying something in the

00:11:16.540 --> 00:11:19.940
context of your work that you're trying to learn, that actually could make a huge difference

00:11:19.940 --> 00:11:20.720
over a couple months.

00:11:20.720 --> 00:11:22.740
So that's usually pretty good to do.

00:11:22.740 --> 00:11:29.400
I completely value in my employees somebody that really wants to increase their skill set

00:11:29.400 --> 00:11:33.720
and also cares about saving the company money and making things better.

00:11:34.340 --> 00:11:38.460
So at the very least, your management chain should know that you care about that too.

00:11:38.460 --> 00:11:39.960
They should care about that.

00:11:39.960 --> 00:11:43.500
People who care about this stuff and who are actively working on it, those are the type of

00:11:43.500 --> 00:11:44.180
people you want.

00:11:44.180 --> 00:11:49.000
The ones that don't complain, that are just going to work on that old 20-year-old technology,

00:11:49.000 --> 00:11:51.760
that's fine that they're great employees and they're doing that.

00:11:51.760 --> 00:11:54.020
But that's not going to push you guys forward.

00:11:54.020 --> 00:11:56.720
So definitely, I think people should see this as a positive.

00:11:57.520 --> 00:11:57.760
Awesome.

00:11:57.760 --> 00:12:03.580
Speaking of making and making things better, DigitalOcean has made online cloud storage

00:12:03.580 --> 00:12:06.960
for apps much, much better with their new thing called Spaces.

00:12:06.960 --> 00:12:10.360
So check out Spaces at do.co slash Python.

00:12:10.360 --> 00:12:15.140
And the idea is it's a similar service to Amazon S3, right?

00:12:15.140 --> 00:12:17.880
You have just a cloud storage.

00:12:17.880 --> 00:12:22.080
You can have either private or public things stored up there.

00:12:22.080 --> 00:12:24.000
Huge, huge amounts of data.

00:12:24.640 --> 00:12:28.140
If your app has, say, processed a bunch of pictures and you've got to store the picture

00:12:28.140 --> 00:12:32.760
somewhere, instead of jamming them in the database, put the gigs of pictures up in Spaces.

00:12:32.760 --> 00:12:38.800
And it's really easy to adopt because it uses the same APIs as S3.

00:12:38.800 --> 00:12:45.640
So tools like the Transmit app I use on my Mac, I just pointed at the URL for Spaces and I tell

00:12:45.640 --> 00:12:47.040
it's an S3 thing and it just works.

00:12:47.040 --> 00:12:49.620
So that's super cool and easy to do.

00:12:49.620 --> 00:12:52.940
The pricing is so much better than S3.

00:12:53.280 --> 00:12:58.420
$5 a month flat for 250 gigs of storage, a terabyte of outbound bandwidth, which would

00:12:58.420 --> 00:13:01.600
be like $90 alone on S3.

00:13:01.600 --> 00:13:04.840
And then it's just one cent per gigabyte instead of nine.

00:13:04.840 --> 00:13:07.040
So definitely, definitely check it out.

00:13:07.040 --> 00:13:09.720
I'm using it for this podcast and many other things.

00:13:09.720 --> 00:13:12.000
The audio you're listening to came over it.

00:13:12.000 --> 00:13:12.980
So how about that?

00:13:12.980 --> 00:13:16.560
It's super easy to use and it's a great deal and very predictable.

00:13:16.780 --> 00:13:20.340
So do.co slash Python and check out DigitalOcean Spaces.

00:13:20.340 --> 00:13:24.720
Let's talk about visualizing things as well here.

00:13:24.720 --> 00:13:28.700
So last week you brought up that deep dive inside of garbage collection.

00:13:28.700 --> 00:13:30.160
That was a super good article.

00:13:30.160 --> 00:13:35.460
And I really appreciated getting a look at how the reference counting GC worked, about how the

00:13:35.460 --> 00:13:41.580
actual mark and sweep garbage collector that would solve the cycle problem worked, how Python

00:13:41.580 --> 00:13:42.700
uses that combination of them.

00:13:42.700 --> 00:13:47.000
And a lot of the really nice details about at this number, it behaves differently if it's

00:13:47.000 --> 00:13:48.040
bigger or smaller, right?

00:13:48.040 --> 00:13:49.700
These little cutoffs are always fun to know.

00:13:49.700 --> 00:13:55.640
There are many different garbage collection algorithms of which reference counting and mark

00:13:55.640 --> 00:13:56.720
and sweep are just one.

00:13:56.720 --> 00:14:01.060
So this guy named Ken Fox, it's not a brand new article or anything, but it's really a

00:14:01.060 --> 00:14:01.880
cool follow-up.

00:14:01.880 --> 00:14:05.700
Wrote this thing called Visualizing Garbage Collection Algorithms.

00:14:05.700 --> 00:14:09.900
And yeah, I think this is, if you like the last article, you should definitely check out this one.

00:14:09.900 --> 00:14:15.620
The little videos on visualizing this are, they're kind of mesmerizing.

00:14:15.620 --> 00:14:18.560
I kind of want to like leave one up on my screen or something.

00:14:18.560 --> 00:14:19.500
They're great.

00:14:19.500 --> 00:14:20.180
Yeah, exactly.

00:14:20.180 --> 00:14:23.840
If you could have a screensaver of visualized GCs, it would be beautiful.

00:14:25.420 --> 00:14:28.540
We need that company that made the toasters, the flying toasters.

00:14:28.540 --> 00:14:30.140
We need them to make that, right?

00:14:30.140 --> 00:14:32.520
Even though I covered it last week, I'm trying to remember.

00:14:32.520 --> 00:14:37.740
The Python is both a reference counting collector and a mark sweep collector, right?

00:14:37.740 --> 00:14:38.080
Right.

00:14:38.080 --> 00:14:41.560
So by default, Python tries to use reference counting.

00:14:41.560 --> 00:14:45.820
So every time you have a pointer to an object, it increments the counter.

00:14:45.820 --> 00:14:49.500
And then once that counter goes back down to zero, then it just deletes it.

00:14:49.840 --> 00:14:57.280
The problem with all reference counting collectors are, if you have any form of cycle, that's straight up a memory leak right there, right?

00:14:57.280 --> 00:15:00.740
Parent, child, child, parent, boom, never goes to zero, never deleted.

00:15:00.740 --> 00:15:02.740
That can be a huge problem.

00:15:02.740 --> 00:15:05.560
And so there's ways to solve that.

00:15:05.700 --> 00:15:09.860
Usually that's some other kind of managed garbage collector, right?

00:15:09.860 --> 00:15:14.260
And that's why they bring in the mark and sweep one, because it goes and finds these cycles and gets rid of them.

00:15:14.260 --> 00:15:22.440
One of the questions I have that I don't expect you to have the answer, I'm curious about it, is if fragmentation becomes a problem within Python or not.

00:15:22.440 --> 00:15:23.100
I think it does.

00:15:23.100 --> 00:15:23.900
I think it does.

00:15:23.900 --> 00:15:25.460
You can actually see it in the picture.

00:15:25.580 --> 00:15:28.020
So let's go through the five visualized here.

00:15:28.020 --> 00:15:29.780
So there's actually five different types of GC.

00:15:29.780 --> 00:15:34.960
There's no GC, which just means we're just going to allocate and not clean up stuff.

00:15:34.960 --> 00:15:38.180
Hopefully we won't spend too much memory, and that'll be fine.

00:15:38.180 --> 00:15:42.680
Like, that's actually a super efficient way as long as you have enough memory.

00:15:43.200 --> 00:15:52.020
And it might sound outrageous, but Apache, Apache web server, actually creates small pools of memory per request and then just throws them away and doesn't try to manage that memory.

00:15:52.020 --> 00:15:53.180
Dirty.

00:15:53.180 --> 00:15:56.040
So, you know, I guess in like small doses that could work.

00:15:56.040 --> 00:15:59.860
There's the reference counting one, and that's Python's first pass, as we talked about.

00:15:59.860 --> 00:16:09.080
There's a mark and sweep collector, which goes and says, I'm going to start at all the known pointers that I have, follow them, the things they point to, da, da, da, right?

00:16:09.160 --> 00:16:17.160
Follow all that sort of transitive closure of pointers and indicate or mark everything that is not garbage.

00:16:17.160 --> 00:16:18.980
So it's like a not garbage finder.

00:16:18.980 --> 00:16:20.840
And whatever it doesn't find, well, that's garbage.

00:16:20.840 --> 00:16:28.760
And then there's some stuff more like Java and .NET and those types of things that are mark and compact collectors.

00:16:28.760 --> 00:16:29.720
All right.

00:16:29.720 --> 00:16:31.540
So Python, you asked about the fragmentation.

00:16:31.540 --> 00:16:36.100
It doesn't, as far as I know, it doesn't move the memory around and change where the pointers point.

00:16:36.980 --> 00:16:39.280
After it does a collection, it just cleans up the cycles.

00:16:39.280 --> 00:16:40.280
Right.

00:16:40.280 --> 00:16:46.680
And so if you had like a 10-byte object in between two things that got cleaned up, that 10 bytes is just a hole.

00:16:46.680 --> 00:16:47.300
Right.

00:16:47.300 --> 00:16:48.060
Maybe you can fill it.

00:16:48.060 --> 00:16:48.760
Maybe you can't.

00:16:48.760 --> 00:16:53.640
But the compacting ones, those will like squish the memory back together.

00:16:53.640 --> 00:16:59.340
And what's interesting about the compacting ones is allocation in a compacting collector is insanely fast.

00:16:59.340 --> 00:17:02.480
Probably faster than C++ or C.

00:17:02.480 --> 00:17:07.720
Because you don't have to traverse that list of open slots where your new memory might fit.

00:17:07.720 --> 00:17:11.380
You just always allocate at the end because you've compacted it down.

00:17:11.380 --> 00:17:11.600
Right.

00:17:11.600 --> 00:17:16.560
So allocate means increment a pointer by, you know, you want 10 bytes, you increment the pointer by 10.

00:17:16.560 --> 00:17:16.920
Done.

00:17:16.920 --> 00:17:17.980
Right.

00:17:18.040 --> 00:17:19.040
So it's pretty interesting.

00:17:19.040 --> 00:17:20.520
There's a couple of kinds.

00:17:20.520 --> 00:17:23.240
And so this goes through and visualizes all of these.

00:17:23.240 --> 00:17:28.780
And you can actually see the effect and you can see the fragmentation that you were talking about in the reference counting one.

00:17:28.780 --> 00:17:31.920
But it's pretty cool, this set of visualizations.

00:17:31.920 --> 00:17:32.420
Definitely.

00:17:32.660 --> 00:17:36.840
You know, I feel like I should be using Pathlib more than I do.

00:17:36.840 --> 00:17:40.200
And I just do os.path.join and that sort of stuff.

00:17:40.200 --> 00:17:42.520
They're the older style of working with paths in Python.

00:17:42.520 --> 00:17:44.240
And that's worked with me.

00:17:44.240 --> 00:17:48.540
But this article by Doug Hellman that you pull out here, this is pretty cool.

00:17:48.540 --> 00:17:50.720
And it makes a solid case for Pathlib.

00:17:50.720 --> 00:17:51.700
Yeah, actually.

00:17:51.700 --> 00:17:54.800
And so I went back and I'm like, when did Pathlib come in?

00:17:54.800 --> 00:17:58.000
And suppose it came in introduced in Python 3.4.

00:17:58.000 --> 00:18:00.140
So it's a Python 3 new thing.

00:18:00.700 --> 00:18:03.960
It's an object-oriented system to work with paths.

00:18:03.960 --> 00:18:05.220
So paths as objects.

00:18:05.220 --> 00:18:13.180
And like we're pointing to Doug Hellman's Python module of the week, the Python 3 version.

00:18:13.180 --> 00:18:15.460
And it's pretty good.

00:18:15.460 --> 00:18:19.340
It's a very quick read to skim over all the sort of stuff you can do.

00:18:19.340 --> 00:18:24.200
Yeah, I learned things just the other day thinking, oh, my gosh, I've been using OS too much.

00:18:24.200 --> 00:18:25.160
I should use this more.

00:18:25.160 --> 00:18:25.780
Yeah, for sure.

00:18:26.300 --> 00:18:33.460
And I was really blown away at the way you use the division to hack the visual, right?

00:18:33.460 --> 00:18:36.180
Like the way you use the divider, like forward slash.

00:18:36.180 --> 00:18:39.160
So you can have like one path forward slash the other path.

00:18:39.160 --> 00:18:43.420
And it just joins them as if it was this thing slash that thing in the actual string, right?

00:18:43.500 --> 00:18:53.140
And you can use that division operator with either path objects or just some quote strings and characters and quotes to add things to your path.

00:18:53.720 --> 00:18:55.700
And I didn't know that it had glob in there.

00:18:55.700 --> 00:18:56.560
So that's pretty cool.

00:18:56.560 --> 00:18:58.120
And iter dirs.

00:18:58.120 --> 00:19:01.420
Iter dir for like iterating over files in a directory.

00:19:01.420 --> 00:19:02.800
That's pretty nice.

00:19:02.800 --> 00:19:03.160
Right.

00:19:03.160 --> 00:19:10.280
One of the things that's annoying about os.path is if you want to actually create directories or delete them or stuff, there's like all these unrelated ways.

00:19:11.120 --> 00:19:17.220
Like you go out to other areas, you know, like OS.maker rather than os.path.maker.

00:19:17.220 --> 00:19:19.760
It's just funky inconsistencies.

00:19:19.760 --> 00:19:20.900
And this like brings it all together.

00:19:20.900 --> 00:19:23.640
You can like create and delete directories and things like that.

00:19:23.640 --> 00:19:36.100
And then there's some top level stuff for concrete paths that are shortcuts like path.home and path.cwd that just work whether you're on Windows or a Linux-based POSIX system.

00:19:36.100 --> 00:19:36.640
Yep.

00:19:36.640 --> 00:19:37.520
That's really nice.

00:19:37.520 --> 00:19:38.340
Cool.

00:19:38.340 --> 00:19:38.560
Yeah.

00:19:38.640 --> 00:19:42.440
So definitely speaking of learning new things, here's something people can learn.

00:19:42.440 --> 00:19:42.900
This is great.

00:19:42.900 --> 00:19:47.400
So we talked about visualization before, but, you know, can computers see?

00:19:47.400 --> 00:19:48.060
Yeah, sure.

00:19:48.060 --> 00:19:49.100
I think they can.

00:19:49.100 --> 00:19:54.920
I mean, cars, we're surprisingly close to a world where cars can drive on their own.

00:19:54.920 --> 00:19:55.600
Are you ready?

00:19:55.600 --> 00:19:56.640
Yeah, I'm totally ready.

00:19:56.640 --> 00:19:56.980
Yeah.

00:19:56.980 --> 00:20:00.100
I mean, we've got a whole bunch of deep learning stuff happening.

00:20:00.100 --> 00:20:02.240
NVIDIA made a car.

00:20:02.240 --> 00:20:07.080
I think we talked about this before where like they just had it observe humans and they made it go drive.

00:20:07.220 --> 00:20:09.540
And like they don't know how it knows how to drive, but it can.

00:20:09.540 --> 00:20:10.560
Things like this, right?

00:20:10.560 --> 00:20:11.660
They didn't teach it to drive.

00:20:11.660 --> 00:20:12.720
It just like learned.

00:20:12.720 --> 00:20:18.740
And so I want to highlight this thing called Luminoth, an open source computer vision toolkit.

00:20:19.100 --> 00:20:26.940
So this is a new computer vision toolkit for Python, and it uses deep learning to understand computer vision.

00:20:26.940 --> 00:20:35.760
So basically its main job right now is to work on object detection and classification, but they're trying to do a lot more with it.

00:20:35.760 --> 00:20:37.220
Like that was the first problem they solved.

00:20:37.220 --> 00:20:44.700
So it's built Python, it uses TensorFlow and Sonnet, which is Google's deep learning framework and deep minds graph library.

00:20:44.700 --> 00:20:47.820
So these are really cool.

00:20:47.820 --> 00:20:52.800
This is the same thing that Google is using very likely for things like its AI that just beat Go.

00:20:53.740 --> 00:21:01.640
Or it had beat Go before, but they just announced that there's a new AI that beat Go without anyone teaching it how to play Go.

00:21:01.640 --> 00:21:05.960
So that's news this week as well, by the way, although I don't have a link to the article.

00:21:07.040 --> 00:21:09.700
So you can super easily train this thing.

00:21:09.700 --> 00:21:15.120
It's like a couple of lines of code, and then you can start asking it to find stuff in objects.

00:21:15.120 --> 00:21:16.580
And it'll say, that's a bike.

00:21:16.580 --> 00:21:17.440
That's a hand.

00:21:17.440 --> 00:21:18.240
That's a person.

00:21:18.240 --> 00:21:19.380
The face is over here.

00:21:19.380 --> 00:21:20.420
No, that's three people.

00:21:20.420 --> 00:21:21.600
Things like that.

00:21:21.600 --> 00:21:22.380
Really, really cool.

00:21:22.380 --> 00:21:29.380
And it uses this modern state-of-the-art algorithm called Region-Based Convolutional Neural Networks.

00:21:29.380 --> 00:21:31.380
R-CNNs.

00:21:31.380 --> 00:21:35.180
It even comes with GPGPU support.

00:21:35.760 --> 00:21:36.460
And it's cool.

00:21:36.460 --> 00:21:46.020
They even are going to send pre-trained checkpoints for objects that is already pre-classified with some really large data sets from other challenges.

00:21:46.020 --> 00:21:46.540
Oh, wow.

00:21:46.540 --> 00:21:46.980
That's great.

00:21:46.980 --> 00:21:47.400
Isn't that cool?

00:21:47.400 --> 00:21:54.800
So if you want to go and create a project that does some sort of image classification or identifies objects in images, check this out.

00:21:54.800 --> 00:22:03.940
Because if it comes with pre-trained algorithms already, and you have a similar type of data as what they already trained it on, you might be able to just pick this up and use it.

00:22:03.940 --> 00:22:04.120
Yeah.

00:22:04.240 --> 00:22:08.520
Well, one of the examples it shows is detecting dinosaurs in a picture.

00:22:08.520 --> 00:22:08.860
Yeah.

00:22:08.860 --> 00:22:09.500
That's awesome.

00:22:09.500 --> 00:22:11.440
So you could build like a home security?

00:22:11.440 --> 00:22:11.880
Yeah.

00:22:11.880 --> 00:22:14.780
It'd be useful so that you could find out if a dinosaur is at the door.

00:22:14.780 --> 00:22:16.280
Don't open it.

00:22:16.280 --> 00:22:17.120
No, it's a dinosaur.

00:22:17.120 --> 00:22:18.280
It'd be great.

00:22:18.500 --> 00:22:26.480
If you could come up with a doorbell that rings differently based on what it detects.

00:22:26.480 --> 00:22:26.780
Oh, nice.

00:22:26.780 --> 00:22:32.160
If it detects a kid, like one of your kid's friends is at the door, it could make one kind of noise.

00:22:32.160 --> 00:22:35.240
If it's a UPS guy, it could make a package noise.

00:22:35.240 --> 00:22:37.080
I mean, wouldn't that really be a cool product?

00:22:37.280 --> 00:22:40.600
Yeah, like a really big happy sound if it's a pizza delivery guy.

00:22:40.600 --> 00:22:41.100
Yes.

00:22:41.100 --> 00:22:41.820
Pizza.

00:22:41.820 --> 00:22:44.180
You've got mail.

00:22:44.180 --> 00:22:44.500
Let's do that.

00:22:44.500 --> 00:22:44.880
Yeah.

00:22:44.880 --> 00:22:46.340
That sounds like a very good business.

00:22:46.340 --> 00:22:46.960
Let's do that.

00:22:46.960 --> 00:22:47.900
All right.

00:22:47.900 --> 00:22:51.200
So anyway, if you guys are into image recognition, check this out.

00:22:51.200 --> 00:22:52.040
It's a cool project.

00:22:52.040 --> 00:22:52.560
Luminoth.

00:22:52.560 --> 00:22:53.820
It's fairly new.

00:22:54.440 --> 00:22:55.440
You got a bonus for us, right?

00:22:55.440 --> 00:22:55.980
Yeah.

00:22:55.980 --> 00:23:01.300
I was going to put this as one of my picks, but it felt kind of...

00:23:01.300 --> 00:23:04.540
Anyway, there's a bonus article called The Cleaning Hand of pytest.

00:23:04.540 --> 00:23:11.300
And it's somebody else's experience of what it was like to work in unit test and nose after using pytest.

00:23:11.300 --> 00:23:13.880
And I feel a little...

00:23:13.880 --> 00:23:15.180
Actually, I don't feel bad at all.

00:23:15.180 --> 00:23:17.760
But at the end, he links to my book, which is good.

00:23:17.760 --> 00:23:19.280
So check that out.

00:23:19.280 --> 00:23:19.940
Oh, that's nice.

00:23:19.940 --> 00:23:20.960
That's a nice validation.

00:23:20.960 --> 00:23:21.320
That's cool.

00:23:21.320 --> 00:23:22.760
Yeah, The Cleaning Hand of pytest.

00:23:22.760 --> 00:23:23.580
That sounds really fun.

00:23:23.580 --> 00:23:24.040
How about you?

00:23:24.120 --> 00:23:24.760
What's up with you?

00:23:24.760 --> 00:23:26.360
Well, not a whole lot going on.

00:23:26.360 --> 00:23:27.980
I wanted to highlight two things.

00:23:27.980 --> 00:23:29.720
You mentioned the various PyCons going on.

00:23:29.720 --> 00:23:33.280
And PyTennessee 2018 is coming up.

00:23:33.280 --> 00:23:41.920
So if you're anywhere near Nashville and you want to go to a PyCon, you don't want to wait until May to go to the big, big PyCon in Cincinnati.

00:23:41.920 --> 00:23:43.560
I think it's somewhere in Ohio this year.

00:23:43.560 --> 00:23:49.540
You can go in February 10th and 11th and go to one in Nashville, PyTN.

00:23:49.540 --> 00:23:50.620
So check that out.

00:23:50.620 --> 00:23:51.500
That's really awesome.

00:23:51.500 --> 00:23:52.080
That'd be fun.

00:23:52.080 --> 00:23:52.420
Yeah.

00:23:52.580 --> 00:23:54.580
I was thinking of trying to go.

00:23:54.580 --> 00:23:58.140
But it turns out that my wife's already out of town that week.

00:23:58.140 --> 00:24:00.900
And with children, we can't both be out of town the same week.

00:24:01.400 --> 00:24:03.660
So that sort of squashed that.

00:24:03.660 --> 00:24:06.580
The other thing really quick is I wanted to point out a movie.

00:24:06.580 --> 00:24:07.340
It's not super new.

00:24:07.340 --> 00:24:08.260
It's like a couple years old.

00:24:08.260 --> 00:24:10.980
But I think people in this audience will really appreciate it.

00:24:10.980 --> 00:24:12.560
Are you into gaming, Brian?

00:24:12.560 --> 00:24:13.140
No.

00:24:13.360 --> 00:24:13.540
Yeah.

00:24:13.540 --> 00:24:14.140
I'm not either.

00:24:14.140 --> 00:24:19.500
I'm kind of oblivious to this world and what has happened to it in the last five years.

00:24:19.500 --> 00:24:21.680
But there's this movie called All Work and All Play.

00:24:21.680 --> 00:24:22.580
It's available on Netflix.

00:24:22.580 --> 00:24:23.520
I linked to the trailer.

00:24:24.560 --> 00:24:31.300
And it is a really interesting look inside what has been going on in the world of professional gaming.

00:24:31.300 --> 00:24:31.700
Wow.

00:24:31.700 --> 00:24:37.400
So if you're into that, there's basically, they had the world championship of gaming they had in Poland.

00:24:38.340 --> 00:24:40.220
And there's some big upsets and surprises.

00:24:40.220 --> 00:24:43.620
And I think they said 100,000 people attended in person.

00:24:43.620 --> 00:24:44.840
I mean, it's like insane.

00:24:44.840 --> 00:24:50.200
So if you haven't been paying attention to this, this movie is pretty eye-opening.

00:24:50.200 --> 00:24:52.240
So this is people playing video games?

00:24:52.240 --> 00:24:55.260
This is a competition of League of Legends players.

00:24:55.260 --> 00:24:56.700
I think there were six teams.

00:24:56.700 --> 00:24:57.120
Okay.

00:24:57.120 --> 00:24:57.900
Six or eight.

00:24:57.900 --> 00:24:59.100
No, eight teams, I think.

00:24:59.100 --> 00:25:03.120
And then these are people watching the games being played live in person.

00:25:03.120 --> 00:25:04.480
So you're not a gamer either.

00:25:04.480 --> 00:25:08.440
We found two nerds talking to each other, and both of them are not gamers.

00:25:08.440 --> 00:25:10.060
No, not really.

00:25:10.060 --> 00:25:11.380
I mean, my...

00:25:11.380 --> 00:25:11.960
What are the odds?

00:25:11.960 --> 00:25:12.640
I know.

00:25:12.640 --> 00:25:14.200
It's pretty low, I guess.

00:25:14.200 --> 00:25:17.280
My pastime is to work on software projects.

00:25:17.280 --> 00:25:18.200
That's my game.

00:25:18.200 --> 00:25:21.280
It's like solving software problems, not, you know, made-up game problems.

00:25:21.280 --> 00:25:23.800
Every now and then I'll play an iPad game or something, but nothing major.

00:25:23.800 --> 00:25:24.160
Yeah.

00:25:24.160 --> 00:25:24.820
Okay.

00:25:24.820 --> 00:25:26.220
Well, cool.

00:25:26.220 --> 00:25:26.620
All right.

00:25:26.620 --> 00:25:27.160
Well, thanks a lot.

00:25:27.160 --> 00:25:27.560
You bet.

00:25:27.560 --> 00:25:29.240
And I'll catch you next week.

00:25:29.240 --> 00:25:30.660
Thanks, everyone, for listening.

00:25:30.660 --> 00:25:30.880
Bye.

00:25:30.880 --> 00:25:34.300
Thank you for listening to Python Bytes.

00:25:34.300 --> 00:25:36.860
Follow the show on Twitter via at Python Bytes.

00:25:36.860 --> 00:25:39.760
That's Python Bytes as in B-Y-T-E-S.

00:25:39.760 --> 00:25:43.180
And get the full show notes at pythonbytes.fm.

00:25:43.180 --> 00:25:47.520
If you have a news item you want featured, just visit pythonbytes.fm and send it our way.

00:25:47.520 --> 00:25:50.220
We're always on the lookout for sharing something cool.

00:25:50.220 --> 00:25:53.620
On behalf of myself and Brian Okken, this is Michael Kennedy.

00:25:53.620 --> 00:25:57.240
Thank you for listening and sharing this podcast with your friends and colleagues.