← Back to Show Notes

Transcript: Python Crash Course - Eric Matthes

Hello, and welcome to another episode of Django Chat, the weekly podcast on the Django Web

Framework. I'm Will Vincent, joined by Carlton Gibson. Hi, Carlton.

Hello, Will.

And this week, we're joined by Eric Mathis. Welcome, Eric.

Good morning.

So we wanted to have you on for a long time. You are most notably the author of Python Crash Course,

the best-selling Python book in the world the last few years. But you also are involved with

PyCon, Django, teaching, so there's a lot to dive into. And maybe we could start with,

how'd you get into programming? I got into programming in the late 70s, early 80s.

My dad was a programmer, and he had a computer in our house before anybody else had PCs. It was a

little kit computer in our basement. And so I learned BASIC. I learned BASIC because I watched

my dad tap keys in the basement, and it looked like magic. So I asked him how the magic worked,

and he showed me. And I really appreciate that early beginning.

And you grew up, is it New Hampshire, I believe?

Yes.

I just asked because I'm from Vermont, so I like people from our neck of the woods.

Yes. I always enjoy hearing where are you from stories because I think of you as from Boston.

Yeah. Well, I'm not even technically in Boston. I'm a town outside of Boston, but

all this... It's sort of like when I left New England and people didn't necessarily always

know where where boston or they didn't know where vermont was so i would say you know or if i went

overseas i would say it's you know in between montreal and boston kind of somewhere in there

right or you go outside the new england and you know no one has any idea which you know vermont

or new hampshire which is which right why should they even in virginia anyways sorry so you so you

got a young start and then but there wasn't formal education for computer science back then i don't

think right well i feel rather fortunate so my dad was a software engineer in the 70s and so

learning basic was nice um one of my clear memories was building a number guessing game

when i was young um and what i remember from that i don't remember anything about the programming

beyond like line numbers and go to but i remember getting up from the computer having my parents sit

down and play the game that I had written. And when it worked, I remember this feeling, um, of

creating something that other people could use. Um, and that has been a satisfaction that I

remember to this day. And so when I introduce other people to programming, I, I, if it's in

a classroom, I enjoy watching them get to that point of their first program that works, that

other people can see. Um, and for readers, I love, uh, hearing their stories of the things that they

build working. Yeah. I think of that as the aha moment. If you can not just get that, but

periodically have those as you're teaching concepts, like it actually worked. Maybe I

don't understand how it worked, but it actually worked and I can share it with someone. That's

what keeps someone kind of engaged on the long, lonely quest of programming. Yeah. And if you do

it right, you know, when I was teaching math and teaching problem solving, I tell people that it's

a creative act if you're going to solve a problem that you haven't solved before you have to have

some spark of an idea for how to approach that um and so for programming for anything where people

don't give you the characters to type in you have to have some of that same intuition and so that

that first program that you wrote no matter how small your part of it was it working is validation

and encouragement

but for my programming

I grew up when

Logo was being introduced to schools

and so I think we had

probably some Apple 2's

or something in our elementary school classroom

and so the

you know

when I got to high school I think I had

computer science classes I remember clearly

in college

I went for a BS in physics

and so that was in

the early 90's

And so we had to take a variety of programming classes.

There was C, Fortran, Pascal.

And I didn't do a whole lot with those,

but I got a decent grounding in all those concepts

of what a variable is,

how it interacts with the physical memory of a computer.

And I'm grateful for that.

I'm very happy that people these days

don't have to start with those lower-level languages

if they don't want to.

But I'm grateful for having had that early background

in how all this is managed and structured within a programming language.

Well, it must have helped a little bit that you'd already programmed beforehand with your

dad and otherwise, because, I mean, this is currently, I think, the great divide in an

undergraduate computer science program.

Let's call it half of students have programmed before, and maybe they're just, you know,

used to be PHP or they're banging around with something, but they've got those aha moments.

They kind of have some context, even though they don't really understand why.

So when they do learn the fundamentals, things click for them and connect in a way that if it's the very first time you're programming, you don't really understand why you're at that lower level.

Yeah, I think you agree with that statement.

I see that as, you know, if you have that context initially, it makes it easier, but also you have the perspective to understand why you would bother gutting through a, you know, data structures or whatever class that, you know, weeds out people first or second course at the undergraduate level.

Yeah, I am always careful offering opinions on this because I didn't go through that.

Well, no one on this podcast did, so let's just have it.

But, you know, I did.

Okay, so I studied physics, and I got there because I had a chemistry class in high school that I really liked.

I had an AP chemistry class, and the teacher focused on how we think.

So I learned critical thinking really well from a really good chemistry teacher.

And so when I got to college, I started out in chemical engineering, because I liked chemistry, and I thought, okay, I want to apply this. And I got to my chemical engineering class, and it was all about, like, running nuclear power plants. And I thought, I do not want to run a nuclear power plant or a petroleum plant. And I found that my intro physics classes were all about understanding how things work. So that was my first real understanding of the difference between engineering and pure science.

And so, the gatekeeper classes for that was calculus and intro physics.

And so, these were classes that I loved.

I mean, I just loved math and science for just understanding the world.

And I had the good fortune of having good teachers who were supportive and having a decent intuition for these subjects.

But I was surprised, I think, when I got to college to see how viscerally some people hate these subjects.

And I started tutoring, and it's interesting to tutor as a 19-, 20-year-old

because a lot of the people you end up tutoring are people older than you.

And that's a really interesting position to be in.

And as I was tutoring, I found that people liked this subject,

but they didn't like how it was being presented,

and they didn't like the obstacle that it was putting up in their lives

for what they really wanted to do.

And so I think there's a good parallel between that,

that kind of gatekeeping in math and science

and the same kind of thing we see in computer science programs.

I had a similar experience teaching logic to undergraduates.

There was this kind of, in the philosophy department

at the university I went to, there was an intro to logic

because, you know, you have to do symbolic logic.

And half the students there were kind of maths background,

you know, they really just plowed through it

and they all got 100% in the exam.

And the other half were there doing an arts degree

and they had no interest in logic at all

and they didn't want to know anything about it.

And you could see, you know, you try, if you missed, if you lost one, a particular step, they'd sort of never recover.

And it was difficult to fill in the building block.

And it was really, but it was, there's two kinds of people.

There's like, I'm turned off against this.

I'm not interested.

I hate it.

And it's like, but it's fun.

It's easy.

It's, you know, it's the easiest 100% you're ever going to get.

Yeah.

In a way, at that level it was, you know.

Well, I appreciate the question because I do have a clear thought.

I think the people who learn programming before they get to college, before they get to a CS program, when they get to their CS classes, they get to focus on the CS concepts.

And people who have not learned to program, they have to sort out all the things that go into programming, programming environment, compiling, set up your computer, actually writing code, and take in all the CS concepts with that.

It's just too much.

That influences my thinking around like, how would I design a high school computer science program? I think there's a temptation for a lot of high schools to try to imitate a college environment and jump right into CS concepts. And if I were to design a high school CS curriculum, I would focus on all the things you can do just as a programmer, all the things you can build, all the problems you can solve and leave the hard CS to when people get to university.

yes i mean it's almost mystifying why that's not obvious to people and i can only assume that it's

some degree of it's been so long since they own that mindset or you know they just there's yeah

i mean it's like pre-select if you can grind through a computer science curriculum uh curriculum

and you find it interesting you've already checked a bunch of boxes so maybe it just never

occurred to you that people would wonder well why would i do this or what's the you know what's the

benefit for all this um so i mean i know you feel the same way like i feel you know teaching this

stuff that in many ways it's a benefit that i have zero formal background or even teach in a

formal environment because i'm not limited by any of those things and so while there's a understanding

of the copus of knowledge i feel like you can attack it in so many different ways and just as

you said like start with the why and you know make it engaging don't just drill it and kill it and i

i don't really understand why that's not more clear to people in the system but perhaps they've

just they grew up with that system it worked for them you know it just sort of weeds out

other lines of thought or something i don't know it's a little surprising to me but i think the

high school level is where you can have the biggest impact you get to you know you get to the collegiate

level and people have phds and there's a sense of this is the body of curriculum you need to know

to be a computer science graduate but the high school level it's all i mean that's actually i'd

you know maybe you jump ahead so you you've taught high school for many many years and one thing as

an outsider i found interesting is hearing about well what would it take to teach computer science

to every american because i'd write in britain carlton it's just like mandated as a couple

years ago and maybe in spain right but they're trying at least yeah yeah yeah that's the goal

the goal is that um a generation on people are computer literate in a way that currently our

main developers are and the rest of the population kind of aren't yeah well that at least for where

i said that's not even on the spectrum of the american i mean not not everyone's going to be

a compiler writer right but everyone's going to be able to script you know something like python

or javascript to be able to script up a something or other that's that that's the goal right okay

i'm gonna tee this up for eric because i mean obviously you're the domain expert but what one

thing i've been struck by is even if we had an you know the perfect curriculum and even if we had

a workforce of you know high school teacher salaried programmers who knew this stuff there's

still the issue of well we already have an existing curriculum it has to it does it count

as an elective is it a science class in many states it doesn't even count as a science class

so it has to count as an elective and while private schools and wealthy public schools have

a bunch of electives. A lot of traditional schools don't even have electives. So there's

just all these variables around if you had a magic wand, it's not enough to have the workforce and

the curriculum and the hardware. There's still all this political stuff that needs to get done

just to cram it in because it's going to take the place of something else. So anyways, I tee that up

to you with your decades of experience in the system. You were going to ask about my experiences

at PyCon. And it's been pretty, it was pretty funny to get into the programming world more

seriously. You know, to finish out that story of how I came to write a book and whatnot.

Mid-2000s, I was doing some hobbyist programming projects, as I'd always done. And I was using

Java at the time. And I had a friend who said, you should try Python. And this person was

um not a programmer not a cs person um he is just another hobbyist and he the line he said was your

your programs will be about uh 30 as long as your java programs about a third as long and so i was

like okay i don't really want to learn another language but i'll give it a try and so i had that

classic experience of those mid-2000s of writing my first python program be like wow this looks

really weird, but it really is shorter and it looks beautiful and it works. Um, and I really

haven't touched other languages much since, unless it was a very specific, uh, project focused need

for that. Um, and so what really brought me into more, a more professional focus on programming,

um, to be really honest is my father died in 2011, and this is a month after my son was born.

And I live in Southeast Alaska, and my parents had never been up here, and they were about to visit for the first time.

And I say that with a smile on my face now because enough time has passed that I've processed that pretty well.

But my father being a programmer, when he died and I was with my mom that first week, she asked me to go through his computer and see if there's anything worth keeping or to tell her about.

And getting to go through his computer was a really hard experience, but a really healing experience and connecting experience.

One of my takeaways was seeing all these projects that he was working on that would never see the light of day.

And so I realized that if I died that day, you go through my computer and find all kinds of unfinished projects that nobody ever saw any benefit from.

And so that was a really transitional experience for me, and it made me start to focus on, rather than doing a bunch of little hobbyist projects, which are totally fun because you're always starting a new project and not taking it to all the hard work of polishing and making it presentable for others, I really started to prioritize having all these skills that I've picked up over decades of having the opportunities to learn a variety of things.

What can I build that would be meaningful to other people?

What can I build that would help others?

And so I started looking at how to address problems

problems in education. And so that's what led me to PyCon because as a teacher at a small school,

I got to go to conferences and bring things back to our school. And so when they said,

well, what would you like to go to? I said, I actually like to go to a programming conference

and see what I can pick up because most of us go to education conferences. And so it was different

to go to a programming conference. And I was so intimidated because I thought a programming

conference will be a bunch of people who've spent their whole lives programming and will look at me

and say, what have you done? And that very first night at the hotel, waiting for PyCon to start

the next day, I just went down and had dinner and ended up in random conversations with Python

people and found that, wow, half of the people are just like me. They've done other things. They

want to use programming to solve problems. And half of the people are programmers first who are

looking for what kind of problems they should use their programming skills to address.

I found that PyCon was interesting in that it was less pros than DjangoCon. DjangoCon's smaller,

but I guess if you're already at Django, you're a little bit higher, whereas PyCon,

I was also surprised it was a lot of people who were interested in Python as opposed to

professionally using it. Sorry to interrupt. Oh, that's quite right. You should interrupt me.

But that first year, it was 2012, and Paul Graham from Hacker News was the keynote.

And his focus was like 10 hard problems that people should solve.

And one of them was like university computer science.

And somebody got up at the end and said, well, what about high school computer science?

And he said, don't touch K-12 education.

It's too hard.

And that made me laugh.

It also made me rage and say, like, these things can be addressed.

So I think that when we talk about things like high school computer science curriculum in particular, it's just a huge – trying to be careful about words is a huge mess of things to –

Starts with cluster.

Yeah.

Well, it's a huge mess of factors.

You have salary issues.

Anybody who can do – put together and implement a good CS program can probably go make two or three times as much money doing something else.

It's a lot of work to manage teaching and stay on top of current technologies.

Yeah.

And then you have to look whether you have political support within your school, within your school system, your state, and then the country.

And so that's a lot to untangle.

So were you teaching programming at your high school when you went to the PyCon yet?

Yes.

I have been – I was teaching for the last 15 years – yeah, almost 20 years at a school of about 30 to 40 students.

And so there's about 10,000 people in my town, and I was teaching at a small alternative school.

And so we had three teachers.

And so I would teach an intro programming class each fall if I could, and I couldn't always justify fitting it into the curriculum.

um but it was a really interesting chance to explore how you can teach computer science to

people um yeah and it was always python that when you were teaching yes it was after you

discovered python i started that around 2008 um and so i had started using python at that point

and i firmly believe python is the best first language for people who don't necessarily want

um a cs background well you said before about um not focusing on the uh cs concepts but focusing

on using the programming skills right and i think you know can you say more on that because i think

that that there's that's the gold juice right is if if you could learn to do all these things just

pasting stuff together yeah you can get the the fluency to take on the harder concepts right so

okay um so where did python crash course come from so i went back to pycon in 2013 so i spent

a year just kind of taking in like wow okay i could really do something with programming

i started working on some projects to address inefficiencies in education

and there are a lot of them still ongoing yeah so uh 2013 i gave a lightning talk about

some of the ideas I had for how we could build some open tools to address problems and

infrastructural problems in education. And a good part of that was around the concept that

in the 70s or so, computer scientists got together and said, we're going to open source

some things like text editors, like Emacs and Vim are 40 years old now. And that's because,

I mean, my take on that is people at the time said there are more interesting problems to

compete on than building a good text editor and so people open source those and they've been

maintained ever since and those are dedicated tools so if you're a programmer you're in a text

editor all day long or ide and so you want an efficient tool and if you look at teachers

and ask most teachers how do you build your lesson plans they're still in word documents

And if they're not in Word documents, they're in some proprietary software that they're forced to use by their school or district. And so when people move on, all that work of their life's lesson plans is either mired in thousands of Word documents that you cannot do anything with, or a proprietary system they lose access to or becomes obsolete.

So I just gave a short pitch about how we could take the open source principles and the true principles of access and rights of modification and things like that, not just free, and build some infrastructure.

And so I got to cheer.

And it's so intimidating to give a lightning talk at a conference with 1,500 people and everybody's looking at their phones and laptops.

And as a teacher, having 1,500 people looking at phones and laptops while you're talking is really hard.

But at one point I said something to the effect that proprietary software will never create a revolution in education.

And a bunch of people looked up and gave a little cheer.

Yeah, ding, ding, ding.

Yeah.

So Bill Pollack is the owner of No Storage Press.

And he was in the audience and he came up afterwards and said something along the lines of,

My kid is bored in school occasionally, and I hope you build what you're describing.

And if you want to write a book, here's my card.

And so I was not looking to write a book because I wanted to build these tools for education.

But I went back to my classroom, and I had been teaching programming, and I had a list on my wall in my classroom.

And the title of that list was, What's the Least You Need to Know About Programming in Order to Do Interesting Projects?

And that list was the first half of Python Crash Course.

And I had been trying to give students resources where they wouldn't be depending on me to guide them through learning to program.

Because I recognize that many students can learn at their own pace.

But all the resources I could find around then, 2012, 2013, they just made too many assumptions about what you already know.

um things like how to use a computer um how to find hidden files how to set up a programming

environment any number of things there are just too many assumptions so that um even well my

students couldn't do it as independently as i'd hoped um they got through it because i was there

to teach them but i recognized that they couldn't use these resources independently and so that's

where the the um the core structure of python crash course came from making no assumptions

about what people know but also speaking to them as mature learners because the other resource that

was available back then were python for kids kind of books one of the things i love about your book

is the the structure because i think about this a lot teaching and specifically that most most

books still most python books i i view it as what how do you teach someone their first language

versus their third or fourth and when you see someone's third or fourth you say okay we you

understand there's basic data types boom let me dryly go through the list here's variables here's

how you do functions here's how you do classes and it's so tempting to teach it to a fellow

programmer that way because that's how you would when you're on language whatever but for that

first language like you and your book you don't like you you go to list right away like you're

not as dryly in that bucket of like here's the data types here's the data structures which which

i love and i i realize it's actually quite difficult to do when you know those things

because that's kind of probably how you learned it coming from java yet obviously you had the

experience of years of teaching it to normal people where they don't give a toss about like

what's a string i don't know what a string is um so i love that you did that and i aspire to do

similar things to not just be wedded to this is how i would teach it to an experienced person but

this is how it you know django how do you teach django to someone who has never done web development

a lot you know a lot of times there's an assumption that historically they came from php they come from

something else but a lot of people it's their first time so anyway so i love that your structure

is that i think it's actually quite challenging to do that well because there's questions about

like when do functions come do they come before lists are they you know um so i'm impressed by

how you did that and i'm curious about the thought of how that developed because i don't i know it

wasn't an accident yeah yeah it uh ties back to carlton's question about um you know what do we

teach people what's going to grab them why do what do we want to show people who say i want to learn

programming but i don't know that i want to be a computer scientist um i look at why people want

why would a high random high school student want to learn programming if they don't know they want

to be a programmer um is to to do interesting things and so when i looked at what my students

wanted to be able to do it tended to come down to something to do with games um people don't

often think this but a lot of students are interested in data at a high school age um

because they're trying to sort out their lives and so things like how much money will i make

from this job, what area of the country should I move to or the world that's safe, that has

a good balance of life.

If people are impacted by health issues, poverty issues, crime issues, that information is

really, really compelling.

So two so far are games, data science, and then the third is apps because everybody wants

to build an app or know how they're built.

And so in the Python world, that is Django.

And Will, I've appreciated your post around Flask or Django.

You know, a bunch of people behind the scenes said you're brave to wade into those waters.

Yes, yes.

It needs to be waded into because there's a lot of assumptions on those questions.

So, you know, Python Crash Course, I've always wanted to take people from an understanding of the fundamentals of programming to how do I make my own projects.

And so the guiding question for Python Crash Course was, what's the least I need to know in order to do these projects?

So every time I had a question about, should I present this aspect of Python?

Should I teach lists?

Yes, because you need them for any interesting project you're going to do.

Should I teach dictionaries?

Yes, because you need to know that.

Should I teach generators?

No, because you can get away with lists for a long time.

So that was the cutting floor question for what to leave in, what to let fall to the floor.

Yeah, well, I think it takes a certain amount of expertise and confidence to leave stuff out.

Because especially as a programmer, there's always a sense of, well, I don't want to not cover this thing.

But if you cover it sloppily, you lose the reader or you're not curating it for them.

Because they can go read Python.org if they're so inclined.

Right, right.

Yeah, the classic, oh, you don't need a book because all the information is online.

Yes, if you can sort through it.

You can go to Python.org, you can open up the Python tutorial.

That's not a tutorial, right?

That's exactly Will's case.

You already know two or three languages.

you know you can read about the data type it's not it's not how to program it's not how to use

python well and i always ask people who say like some some version of like such and such is easy

like everyone knows how to do that i'm like go find a random person with a new computer and have

them install python yeah i 99 out of 100 they're not going to get all the way through even if it's

a mac even if they like between installing it properly path virtual environments it's you know

so i think if people actually do that they go oh wow like even that step right because there's so

many things like we as developers like even my computer now like i am sort of like oh if i had

to set up a new computer from scratch like i had to set this up last year and i decided not to just

port over all my old things but to do it from scratch it's just like it was two weeks for me

with all these little things and but i think people for you just forget right unless you're

dealing with a beginner all the time, you just forget, you know, how bad it is.

Yeah. And I think a lot of programmers grew up around other programmers, whether it was within

their family or their community. And so they didn't notice that when they were setting up

their own computer for the first time, there were 10 little things that they didn't know how to do.

And there was somebody right next to them to say, oh, just do this. And so if you, if you didn't

struggle enough because somebody else took that struggle for you, you don't notice those blocks.

But even things like opening a command line.

Yes.

And it doesn't matter which command line it is.

It's like, well, what is this?

Everything you type is a syntax error and nothing works and there's no buttons to click.

How do you learn that?

We did, but how do you do it?

It's getting harder because all the operating systems, or I shouldn't say all,

Mac OS and Windows continually hide more and more of that.

And so when I started teaching programming in the mid-2000s,

even students who hadn't done anything to do with programming

knew what a file extension was.

And at some point they started hiding file extensions

by default.

And so now you can tell somebody save a file as a .py file

and they have no idea what a dot extension is.

And so you have to explain things like that

if you don't want to lose people.

Yeah.

I mean, I used to make,

I still make the analogy of an automatic versus a manual car,

whereas computers are automatic cars.

And if you go manual using the command line,

you're doing all these things,

why would you do that?

You have, it's harder,

but you have a lot more control

and it can be more performant.

But you know, who knows what a manual car is anymore?

Right.

But it's super satisfying.

People underestimate how much learners, and I've said high school students a lot,

but I always have thought of people old enough to not want kid-focused resources.

So when I say high school students, I'm including anybody from that age all the way up through people in their 20s,

people mid-career, 30s and 40s, and retired people.

They all fit into that category of, I want to learn programming.

I don't have any kind of formal background in it.

What do I do?

One of the really satisfying aspects of the last few years for me has been that Python Crash Course really worked for people from 10 years old to 90.

And getting that continuous stream of email from people in all those different demographics has been super satisfying.

Yeah, that must be amazing.

Yes.

And I'm sure the, I mean, as a question, what are some of the unexpected motivations of that age group for why they turned to programming?

like what didn't you expect you've mentioned a whole bunch of ones but

um well let's bring this back to jango a little bit um so you know the structure yeah um writing

is hard i thought i would write the book in one year it was two and a half years i thought i would

do a draft in the summer during vacation when my kid was two and then just on the back of a napkin

yeah revise it over the school year and it'd be done i didn't get the draft written that first

summer and so writing turned into 4 30 getting up at 4 30 writing for a couple hours uh going

teaching doing family stuff and then picking it back up at 9 30 or 10 at night um so that was long

but um the book is also two books in one so the first half is a classic introduction to programming

um what are variables data structures functions classes and i included um testing because i did

not learn about testing software probably until like 10 or 20 years into my hobbyist career

and as soon as i learned it i was like why didn't somebody show me this a long time ago

um so that kind of thinking what do i wish i had learned um as in as an early programmer

guided some of my thinking on what to include um but another piece of this is a reaction to seeing

the way computer science is introduced in schools and many times it's introduced as here's this cool

project here's a game it's a working game now here's the code for the game now modify this

little part of the code and look you have changed the way this character behaves and people love

that and it's great um but that just motivates you to learn um and so i uh with a book in particular

um i take it as people want to do projects but they also want to be in control of their projects

so if you give them a foundation in how programming works and trust them to have um

the discipline to get through that if you teach them well then when they get to their projects

they're going to be able to run with it um and so that's been satisfying as well and that brings

me back to Django.

That's a great question. How do you teach somebody

who doesn't have any

background in programming how to jump

into Django? I think

one of the reasons that Python Crash Course

has done as well as it has

is because I take people who have never

done anything with programming,

give them a meaningful

introduction to the language and programming

in general,

and then they build a web app

and deploy it. And their friends all

over the world can use it. And that's a pretty impressive, um, accomplishment. Um, and it's why

I'm happy for people who are just learning to program today. Um, you know, I made a number

guessing game on my dad's unfinished computer, uh, on Paul, uh, kit computer in a basement in

the seventies. And that was cool, but there's no way anybody else could have played that.

And now you can do a project like that, put it behind a Django app, deploy it, and anybody in the world can use it.

And so when we talk about satisfaction of building something, building an early project, even if you're doing a lot of following the steps that somebody else wrote out, which you have to for your first Django project, the fact that something that you have built has worked all the way through deploying is incredibly satisfying.

And my hope is for people to go through that process and then step back and kind of look at the parts and say, all right, there's a list.

All right, there's a dictionary.

All right, there's a piece I have no idea what it's doing.

And when people get to those questions, they say, go read Will's books.

Thank you.

Well, you cover quite a lot in just the Django project.

I mean, you cover environment variables, which is something that actually I don't, I mentioned, but I don't cover until the professionals book.

So it's a fairly, it's pretty robust, the learning, what it's learning library.

Is that the one for you?

Learning log.

Yes.

Learning log.

Okay.

Yeah, it's, I mean, but I'm biased.

Of course, I agree.

Like, I mean, you're providing the context for someone.

I mean, that's kind of with my Django for Beginners book.

You've built five projects.

And the first couple, I'm explicitly telling you what's happening, but saying, you know,

it's not going to click for you until the third or fourth time, but I'm going to, but

you need to get it working.

And then again, you have that context and then you can see, oh, maybe I want to learn, like I've used models, but what, how exactly is that?

And, you know, what's a view?

But you're kind of providing that context that someone who hasn't, isn't new to, or someone who is new to web development hasn't, doesn't have.

So I do think there's some degree of like, it's fine to blindly follow for a while.

Great.

Rather than, you know, and I was in, I was motivated or influenced by the Rails tutorial, which when I was learning Django in 2012, 13, I wasn't able to find really beginner friendly resources.

Right.

And yet Rails had the Rails tutorial, was it Michael Hartle?

Hartle, I'm saying his name right.

And the very first thing is, boom, hello world, and deploy it.

And it helped that Heroku was built for Rails initially.

But it was just like, boom, here you go.

And so that's what you do in my book.

The first app is hello world, and you deploy it.

And as you said, then you can share it.

And when I teach in person, I always say, here, add the Google Analytics code.

Just copy and paste this.

Send it to four friends, and guess what?

You can spy on them and find out if they actually looked at it.

And then people's mind explodes, right?

In the same way that I show people, teaching them HTML, I show them how to face the New York Times, write a message, right?

People's mind explodes, right?

It's like, oh, you know, there's a server and there's a client.

Like, that's a great, you know, so the same thing when they can actually track it, you can see the gears going.

They're like, oh, my God.

So, yeah, I agree with that approach.

Yeah, I mean, a fun question for me is, and this is all, it comes back to power.

All right, why did I go into education if I got a BS in physics?

I graduated in 94 with a BS in physics, and I wanted to be a particle physicist.

I was on this quest to understand the universe.

But I didn't want to be a student forever.

I didn't want to wake up and be 30 and still be a student.

And so I took a couple of years off.

I'm looking at Carlton as you say that.

How many years were you getting that PhD?

A few, a few.

That's right.

I did master's everything but project later on.

What's it, ABD, all the dissertation, right?

That's the next step?

Yes.

But I went to teaching for a couple of years.

I taught in New York City for, I committed to teaching for two years and then found that I loved it.

I found that the challenge, the intellectual challenge of trying to teach every kid in a classroom, trying to reach every kid, was as hard as anything I had found in science.

It's pretty easy to stand up and present something and, okay, the kids who get it, great.

But if you take it as your responsibility to find a way to reach every student, wherever they are intellectually, academically, and in their own lives at home, that is hard.

And I'm not sure that you can reach every kid, but the pursuit of that is as satisfying as anything I ever found in science.

And then sharing, you know, what I love about science and math is an attempt to understand the world.

And so helping other people understand the world is incredibly satisfying.

So that's what kept me in teaching.

And so I think of teaching as sharing power, sharing understanding and sharing power.

If you understand the world, people can take less advantage of you, and you can do more to control your world and the world of people around you.

And so when we think about technology and things like apps, you guys are well familiar with the idea that the people who build the tools that we use, the apps that we use every day, have power over our lives.

And so for me with Django, the magic of Django is if you can teach people Python in a reasonably efficient use of their time and then teach them how to build a web app, if they never touch code again, they have such a clear understanding of how the technological tools that they're using every day are built.

And I like to think of pulling the curtain away.

It seems like magic when people are not programmers and they use all these apps.

Why can't Twitter do more to control abuse?

Why can't social media do more to fight disinformation?

Well, they can.

It's a lot of political choices and economic choices about how to.

But when you've written code that has some if statements in a Django app, you have a sense of how those people might approach that.

And if you want to build that, you can.

So one of the joys about going to PyCon is half the talks are technical and half the talks are what happens when people who have this new power start to address the problems in their lives.

No, I mean, for me, that power to make changes, that's one of the things that makes being a software developer exciting, is that you can write and you can build things.

It's one of the things that I try and communicate to other people.

This is what programming is all about.

It's shaping the world, you know.

Yeah. Well, I love how you talk about math and science in terms of understanding the world,

because I have a liberal arts background, and I often like the idea of it's understanding people.

So you can say, okay, history is what happened. Politics, government is, well, what were the

institutions doing to control it? Economics is, well, how did the money impact? And literature is,

well, what was kind of the psychology of people at the time? So you can come at the same events

or situations from all these different lenses in the same way that in the sciences you know there's

like the math there's the physics there's chemistry biology they all intersect and so if you have the

holistic idea of trying to tackle the same thing but just a different angle it's uh helpful to me

in terms of i never thought of it quite as much in terms of the sciences coming together but

definitely in terms of the the arts side in philosophy of course carlton as well is another

way of tackling the same issues um you know i i must say carlton i mean i uh this is an aside

like i loved philosophy the first couple courses i took but it felt to me like you were arguing

without any content to deal with and why i was a history major is because i was like well you're

doing all these things but there's actually like what actually happened right it's not just abstract

that was what lost me with well okay yeah no i mean there's the but this plato discusses this

what's the difference between the philosopher and the sophist right the sophist uses the rhetorical

tools uses the arguments for the sake of argument for making the weaker argument look the stronger

that it's a game it's it's it's not a quest for truth whereas the philosopher is the quest for

truth and the the difficulty is you they look like academic debates they look they can be

dry and they can lose their connection to the world but you know philosophy itself is is that

deeper quest fair enough um so eric you've already sort of no no i oh we'll see um um you've already

indirectly answered this but one question that i'm asked all the time that i'm gonna throw to you is

how much python and what python do i need to really understand before i should dive into

django and web apps oh first half of python crash course yeah exactly no that's that's a good

question and um i think that's a really important question to ask um i've had a hard time with that

question when i've when it's asked outside of the context of my book because i've never liked to

feel like i'm plugging my book um but that was uh my guiding question in figuring out what to include

in the first half of that of python crash course because one of my goals was to get people ready

for a game project, ready for data science analysis and visualizations, and ready for

a Django project.

And I think if you ask that same question of how much people need to know for building

games, how much do they need to know for doing introductory data analysis and visualization

and Django or Flask or any number of web apps, I think you need to know what a variable is.

This idea that it's a reference to information, points to information.

You need to know about collections, you need to know about lists, you need to know about loops, iterations.

You need to know about dictionaries, because dictionaries are the idea of mapping two pieces of information, connecting bits of information.

You certainly need to know about functions, and you need a passing, I should say, introductory level of understanding of classes.

I think a mistake that people make in thinking about learning classes

in object-oriented programming is they think they're going to have

to write a bunch of classes, and a lot of times the real value

in learning about classes in object-oriented programming

is you're probably not going to write too many classes yourself,

but you're going to use classes that other people have created.

So understanding that a class is a representation of a kind of a thing

or a concept, and then an object is an instance of that,

an example of that, a specific element of that kind is important.

I struggled with that for a long time because I didn't learn

object-oriented programming um and i remember going to my dad and saying like what is this

i've been hearing about this for years i've always avoided it um and he said the classic uh it's just

a thing that allows you to combine information and actions and i think that's still pretty

relevant um and it simplifies it but uh it's the big point class is a way you can store information

and define actions together and you can represent real world things and you can represent abstract

concepts um so that's that's just fit i'd throw one more thing in there and that's dealing with

files and exceptions um i like those together because what happens if you open a file that

doesn't exist if you try to and just that word try oh there's a try python word um that's important

and i also throw testing in there and you can make an argument that people don't need to learn

about testing right away. But it doesn't take much to throw the concept of testing your code

in for somebody who has learned all that so far. And I think it's really important to put that in

front of people so that as they do start to get into meaningful projects, they're aware that,

oh, I should start testing my code at some point. I have some idea how to do that. And it's not this

big, giant new thing that they have to deal with learning at some point. Yes, yes, yes, yes. I mean,

Testing, I completely agree. I mean, in my beginner's book, I introduced testing. I kind

of just give it to people. I mean, actually, a separate thing, I want to do a whole course on

testing. But I do say, here kind of it is, I'm going to broadly describe it, but you should have

it and it can run just to get it in their mind. But I do think what you're saying about classes

and object-oriented, to me, that's the piece that you need to truly understand that with Python

before Django makes sense

because what are class-based views?

What are mixes?

I mean, personally,

I'm an advocate of class-based views

over function-based views.

I mean, the source code uses it,

but you should do both.

But I often think of it as,

okay, you can disagree with me.

I often say like,

you start with generic class-based views

and I still like in my own projects,

if I can use that,

shove things into there,

I'll do that.

If I have to go to class-based,

you know, function-based

and in terms of learning,

you start with those,

it just works.

If you want to modify it, then you got to go to classy class-based views.

It's a little scary.

Maybe you rewrite them from scratch as a function-based view.

And then you come back around to, well, I'll just rely on the work of others.

And I'll modify that, you know, one little bit and have cleaner code.

So you kind of need to cover all of it.

But you were making a reaction to my emphasizing class-based views.

No, this is like the Flash versus Django.

Please convince me.

other i mean i want to hear more arguments for function-based views because to me it's i think

you do need i think of it more as the the order in which someone should should have right because

the idea is a programmer would say well i like a function-based view because it's all there in

front of me and i don't want magic and i would say well everything is magic to a beginner so

i'm gonna give it to them in two lines rather than 10 and then i'll backfill it later right after

they've learned how to do a list view a detail view a template view well then we'll do it from

scratch that's what i would say yeah i okay i have always thought of teaching programming first

and teaching python second um so every year i look around at the the language landscape and

ask myself if i should still be teaching python or if there's something better to work with and

teach um i do the same with django and other frameworks and i do the same with aspects of

Django like function-based views or class-based views. In my project, where it's the last project

in the book, it's the last thing that people are going to walk away with from this specific book,

there's so much magic already in the Django project that I look for

what are aspects of this project that people are going to really understand and start to

to work with. And I think from what I've seen so far, function-based views are a little clearer

for people to think about. Here's a function that takes something in. The request parameter is

probably the most magical thing in there. But as far as people writing their queries,

and they're just simple queries in these first projects, and then calling another function

that renders the page.

I like how clear that progression is.

And if I see a clear argument that says

everybody's going to be using class-based views

all the time from now on,

I would switch over to class-based views.

But seeing that people are still using function-based views...

Who are those people?

I think if you're teaching the web problem,

the function-based view approach is great.

you you're turning requests into responses and so you see the requests come in and you

that's the web problem and the class-based views totally hide that and until you go right into the

and you say oh it's just actually a function-based view but you know it's wrapped up in this stuff

and it's but i think if you're teaching the web problem and that's the introduction

it's got to be the clearest way and then okay when do class-based views come in for me they

come in when as soon as you're doing create views or update views or delete views use the generics

because, you know, they're a bit weird

and you have to open class C class-based views

to remember what the parameters are

and all the rest of it.

But they just save you loads of typing.

But I think Will has a different use case

and different audience.

And so what's a good writing principle?

Know your audience.

And so I'm choosing function-based views

because it's the last project

and it's the last chance I have to work with people

in this book.

And Will, you're doing that as a foundation for,

okay, here's the first couple of projects

I'm going to show you.

And then we're going to dig deeper into all of this.

And so I think that your rationale is pretty good.

Well, it's true that I tried to say, you don't have to know much Python to get through my

beginner's book.

But yeah, it does make me think about, to Carlton's point, about the parallels between

the requests.

Yeah, it's something I think about.

I mean, actually, something this morning I was working on is I've played around with

and hopefully I'll have this post out by the time this interview comes out of the idea

of how many ways to do a homepage or a simple page in Django. Because I think this is something

that is really interesting once you're at an intermediate level to understand all the mutations,

but it's completely confusing and non-helpful to a beginner. So when I show someone how to do

Hello World, I say, you know, take as a homepage, I say, okay, well, we're going to create an app,

let's call it Pages, we'll have a template, we'll use Template View, and we'll have a URLs. Good.

But, you know, you can cram it all into the project-level urls.py file.

You can use a string instead of a template.

You can use a function view.

You can use a class-based view.

You know, you can go to the extreme.

Carlton has this wonderful talk about how simple can you make Django to make it.

I forget how many lines of code that is.

We'll link to that.

You gave a talk, and we have a post on it, you know, where you make it flask-like.

So I find that that's, in terms of, again, I always think of, like, what's the order in which I present things to someone?

because I'm not trying to prove to them that I know this. Hopefully I know it. It's what's the

progression given that everything is magic, everything is abstraction. How do I find that

mix between context where they understand what's happening, they have a why, and the harder work

of learning the fundamentals within that. So that's, I don't know if that resonates with you.

But I can think of like, I think six different ways to do that, that homepage. And each one

sheds a light on a different nuance around Django, because I often think of its batteries included,

it has guardrails, but really you can do whatever you want. Like an apps are just like a nicety.

But once you start breaking those things down, right, if I showed that to a beginner and I've

done this, this is like their head explodes, you know, because usually for beginner, what I want

to get across to them is I want them to understand the interaction between models, views, templates,

and URLs. To me, that is the single biggest thing to get over for beginner, because it doesn't

matter the linear progression of which you write them. You kind of need all four and you just need

a to me a bunch of reps before that clicks but once that clicks then it unlocks you know what

is middleware and and so at least as i teach django now that's how i view it is i want to get

someone over that hump and the way i get them is kind of follow me and then i'll fill in the you

know the details as we go well i think that's a good approach i mean you will like go back to um

your goal is to have people get something up and running that works and then you're going to start

to dissect that and so i think for you having fewer lines of code and more magic uh the beginning

is totally appropriate as long as you do um take people through a thoughtful dissection of what was

working so they know what they need to understand and there's some things to leave as magic um you

know we cannot i i wanted to throw this point in um i just still shake my head and marvel at

any notion of dismissing web developers as not real programmers i don't understand where that

comes from unless they're people who just have written so many crud pages that that's what they

think all of web development is there is so much going on in a web development stack

and then you even can ask the question of like what is this particular project addressing

so if it's a science-based site if it's a business site any number of things

not many people can understand truly everything that's happening in that stack and so there's so

much room for us to be learning all the time and so i think most maybe even all of us need to leave

some things as magic or things that other people have sorted out and i could dig into someday if i

need to but i won't until i need to and i think that's totally appropriate and i think it leaves

you uh the space to work on the real world projects that most of us care to work on yeah i think that's

the key to not feeling overwhelmed is to understand that you don't have to master everything right now

it'll you know programming's fractal and on top of that i mean the reason why i like web development

is i think it's it is a liberal art there's there's so many so much nuance to it i mean

front end back end html i mean it's just endless the number of things you can poke around in

um maybe a little harder in a professional context but certainly for hobbies and side things it's

just never ending um which because i i get you know i get stale if it's i i was how can you teach

calculus at the collegiate level right it's four five hundred years old and it's the same thing

you're teaching for 30 years like i find like to me that's the inspiring thing is someone who can

make who can get motivated and interested about that whereas the web is just like well it changes

all the time so i'd love to be bored maybe a little more than i am you know we're probably

getting towards the end of this uh so um i think a good way to wrap this up is to um

kind of remind people reassure people since we've been talking so much on learning how to use django

and learning python um our goal i think we probably share this goal is to make people not need us

and so at some point you know people read my book they read your books they um go through

and learning resources.

But at some point, if you stay with this,

you get to a point where you learn all this

just from reading the documentation.

And you still post questions to Stack Overflow

and you still ask questions of your colleagues and peers.

But you become proficient enough

that you can dig into the internals,

dig into the Django code,

look at other projects and see how they do it.

And so we'd like people to buy our books

and read our books, and we enjoy watching them progress. But I think our goal is a shared goal

of having people not need us and get to that place where they can sort things out for themselves and

be confident in doing that. Carlton, I thought of you last night. I was literally to reading the

docs. I always try to think of what does it feel like to sort of kind of know Django? How do I

impart that to someone? And I view it as I have a sense of the spider, the tapestry, but I don't

have everything i don't know everything and so i was looking at um so why do you use manage.py

versus django admin because i just sort of blindly you know i know django admin i use with start

project and manage.py with run server and and i know carlton knows the answer to this but i never

really thought about it i was like oh yeah like i was reading something and they were like i was

like oh yeah and i go to the docs and it's like oh well you know if you use manage.py it loads in

your your settings module um and to me again i that's exactly your point of like even though

i've been using it like i went and read the docs and a i found it interesting and b i found it

helpful um and you know i could read the docs till infinity and still learn stuff every time so

um and of course i was like i know i know carlton knows that so i've got in front of me i've got um

a document browser open i've got one two three four five six seven eight nine nine open tabs

for the stuff I've been working on

before the podcast here, right?

I have the docs open forever, all the time.

And there's not this idea

that you get to the point

where you don't need the docs

or you don't need the source code.

No, you need more and more and more.

Yeah, it's just the resources you use change.

While we are out of time,

we have links to everything.

We didn't even get a chance

to talk about your Python flashcards.

Are there any concluding thoughts

or would you like Django people to reach out to you?

how do you want to end this? Yeah, I'm always available. I think the easiest place is Twitter

at EH Mathis, and my email is not hard to find. I think one closing thought is if people are

looking for any of these books, my books, your books, anybody's, one thing I get repeatedly is

people who accidentally buy early editions, because I think beginners don't always know

to look for the latest edition of a technical book. So if people are following up on any of

these resources, make sure you're finding the latest edition. That would be the second edition

of your book. Yes. Great. Well, thank you so much for coming on. Wanted to do this for a long time

and I think it'll be really interesting to everyone. So thank you. Absolutely. Thank you.

Thank you for having me. All right, everyone. We're at chat Django on Twitter,

Django chat.com. We'll see you all next week. Bye-bye. Join us next time.