1.0.2 Background Information - IP

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
2 hours 57 minutes
Difficulty
Beginner
CEU/CPE
3
Video Transcription
00:00
>> Hello everyone and welcome back to
00:00
the new intro to Python course on Siberia on-demand.
00:00
If you're here, that means you saw the intro video,
00:00
liked what you saw and decided to come back for more.
00:00
That is absolutely spectacular news for us,
00:00
and particularly for me.
00:00
I'm very excited to have you here and
00:00
>> I'm very excited to be teaching you this course.
00:00
>> Today, we're going to start with Lesson 0.
00:00
Lesson 0 is called Lesson 0 because in programming,
00:00
your very first lesson, we will always index from 0.
00:00
That is key to a lot of
00:00
different parts of computer science.
00:00
It's going to be very important to
00:00
know because if you mess that up,
00:00
you can actually break some pretty astonishing things.
00:00
Lesson 0 soapbox temporarily
00:00
over Lesson 0 is called some background.
00:00
Over the course of Lesson 0,
00:00
we're going to learn about the history of Python.
00:00
We're going to learn about the philosophy of Python.
00:00
I know that sounds a weird thing to say right now,
00:00
the philosophy of Python.
00:00
But it actually does have
00:00
an underlying underpinning philosophy
00:00
and we're going to talk about that,
00:00
and why it's important.
00:00
Then we're going to understand the core functionality
00:00
of Python, what it does,
00:00
how it does, what it does,
00:00
and why it works that way.
00:00
A very, very brief history of Python.
00:00
It was developed in 1991,
00:00
it was released in 1991.
00:00
It was developed by Guido Van Rossum
00:00
over the year preceding that.
00:00
Guido Van Rossum was quoted saying that he decided he
00:00
needed a project to keep him busy over the holidays,
00:00
and decided he would create a language to be
00:00
a spiritual successor to ABC,
00:00
which turned into Python.
00:00
He actually did this as
00:00
a side project just over the holidays,
00:00
I have gone to some extreme lengths to
00:00
avoid spending time with my family and in-laws before.
00:00
But I have to say I've never
00:00
invented a programming language.
00:00
That's pretty impressive.
00:00
Version 3 of the most current major version
00:00
of Python was actually released in 2008,
00:00
just over 10 years ago.
00:00
Version 2 is actually still in use in some places,
00:00
we're going to talk about a little bit here.
00:00
Version 2 of Python is used primarily in
00:00
organizations that are resistant
00:00
to change for some reason.
00:00
A lot of times it's the federal government,
00:00
sometimes it's big corporations that just have
00:00
a huge code base that they can't switch over.
00:00
There a lot of causes,
00:00
but fundamentally, it's been
00:00
more than 10 years now since Version 3 was released.
00:00
Version 2 was intended to be end-of-life,
00:00
I think a couple of years ago now,
00:00
and is now that got pushed back to
00:00
2020 for fear of messing up people's systems.
00:00
But it will be end of life around 2020.
00:00
It's really, really important that we use Version 3,
00:00
and then we upgrade to Version 3
00:00
because it really is an upgrade.
00:00
Version 3 is qualitatively superior to Version 2,
00:00
for a whole host of reasons.
00:00
Not least that it actually
00:00
better follows a lot of programming paradigms.
00:00
All of that said,
00:00
the reason I'm bringing it up and
00:00
the reason why I addressed it here is
00:00
because all of the code in this class and all of
00:00
the programming experience you will gain here,
00:00
will be in Python 3,
00:00
we will not use Python 2 at any point.
00:00
If you're in an organization that needs you to
00:00
learn Python 2, not the place.
00:00
By not the place, I mean not the organization.
00:00
Don't write Python 2 code it's not a good idea.
00:00
This slide is extremely information
00:00
dense and I just want to say,
00:00
don't try and read all of the material on this slide.
00:00
That's not at all what it's for,
00:00
and I don't want you trying to do that.
00:00
However, I wanted to put it up here and it'll be
00:00
in your supplemental material as
00:00
well in a more readable format because there are
00:00
a few specific lines that I want you to see,
00:00
and I want to address here.
00:00
Explicit is better than implicit.
00:00
Simple is better than complex.
00:00
Complex is better than complicated.
00:00
Those three aphorisms are self satisfying statements.
00:00
Statements that are self-contained and they
00:00
are a single point of truth or belief.
00:00
Those are all contained in the Zen of Python,
00:00
which is PEP 20, which is actually
00:00
a Python guiding document.
00:00
The idea here is that this list
00:00
of concept or this list of ideas,
00:00
governs all of the development of Python,
00:00
and governs all of the concepts that are built
00:00
into the language that make it function
00:00
the way it does today.
00:00
The three that I addressed,
00:00
explicit is better than implicit,
00:00
simple is better than complex,
00:00
and complex is better than complicated,
00:00
are not only the first three lines,
00:00
but they're my three favorite lines.
00:00
They're really important to this course,
00:00
and really any Python programming you'll do.
00:00
Because of the fact that when you're writing code,
00:00
more rather when you're working with code,
00:00
more often you're going to be
00:00
>> reading it than writing it.
00:00
>> You only write a program once,
00:00
maybe a couple of times if you're
00:00
rebuilding it for some reason.
00:00
But you're going to write
00:00
the code once and then you're going to have to
00:00
read it over and over again to sustain it,
00:00
to fix it, to supplement it,
00:00
other people are going to come along and have to
00:00
read your code and try and understand what it does.
00:00
Python was intended to be a
00:00
>> very human-readable language.
00:00
>> When you're writing Python
00:00
code you should keep that in mind.
00:00
Sometimes you can't avoid having complex code,
00:00
but if you have to write complex code,
00:00
it's better to write a couple of lines of
00:00
complex code and then write
00:00
a bunch of comments to explain it,
00:00
than it is to have some behemoth monster,
00:00
thousands and thousands of lines of
00:00
Python code that don't make any sense.
00:00
Simple as always, the best option.
00:00
But if you can't be simple,
00:00
at least don't be complicated.
00:00
Or again, this is a very information dense slide.
00:00
It's very small, it's hard to read.
00:00
This is mostly just here to illustrate.
00:00
It's not here for you to try and read through.
00:00
The Zen of Python PEP 20 will
00:00
be in your supplemental materials.
00:00
The design of Python, how
00:00
it actually works under the hood.
00:00
We're not going to get super,
00:00
super technical with this because this
00:00
is an intro level course.
00:00
But essentially what matters here for people
00:00
who've worked with programming languages before,
00:00
we've had to do like memory management
00:00
in C or garbage clean up.
00:00
All of that is handled under the hood in Python,
00:00
you don't have to use malloc,
00:00
you don't have to associate virtual memory,
00:00
all of that is handled for you.
00:00
Python is a relatively secure language
00:00
in terms of memory safety,
00:00
because of the fact that it takes it out of users hands.
00:00
It's a relatively memory-safe language,
00:00
and it's going to do most of that hard work for you.
00:00
Python functions on what's called a REPL.
00:00
There are people who would call that a REPL loop.
00:00
Those are the same monsters who say things
00:00
like ATM machine and pin number.
00:00
REPL stands for read execute print loop.
00:00
It's not a REPL loop, it's
00:00
just a REPL period or a REP loop if you must say loop.
00:00
I understand that this is not
00:00
important and it doesn't matter.
00:00
But it does matter to me because I'm
00:00
a pedantic person and this is important to me.
00:00
[LAUGHTER] But more seriously,
00:00
REPL read execute print is the way that
00:00
the Python implementation interprets your code,
00:00
the way the interpreter interprets
00:00
your code, that's what I was looking for.
00:00
It will read a line of code.
00:00
It will gain the context of that line if it needs
00:00
other lines for more information
00:00
or if it needs other data,
00:00
it will then execute that turn into machine code,
00:00
give it to your system that actually run,
00:00
and then it will print the results.
00:00
Now, that's in the interpreter,
00:00
if you're writing a Python script,
00:00
it will not print every line.
00:00
A lot of time
00:00
in script it's only going to print when you tell it to.
00:00
On the interpreter side,
00:00
if you're assigning the result to a variable,
00:00
it's not going to print to the screen,
00:00
because it's being piped to that variable.
00:00
But the concept still stands.
00:00
It reads, it executes,
00:00
and it outputs that information
00:00
either to print or to some other storage location.
00:00
There are coding conventions in the Python and we will to
00:00
some extent address them during the syntax lesson.
00:00
However, we are not going to
00:00
spend a whole bunch of time on them
00:00
because this is actually
00:00
another quote from Guido Van Rossum.
00:00
A foolish consistency is the hob goblin of little minds,
00:00
which is to say that it is more important to write
00:00
clear readable code that
00:00
matches the style of whatever project you're on,
00:00
than it is to match every single detail
00:00
of the Python coding convention.
00:00
It is more important that your code be easy
00:00
to use and easy to understand,
00:00
than that you use exactly the right cases for everything.
00:00
The coding conventions are useful and I like to
00:00
follow them and you should follow
00:00
them, and feel free to read them.
00:00
You can see that they're on the slide
00:00
>> as a link and supplemental materials.
00:00
>> We'll also include that link,
00:00
but they're not laws, they're guidelines.
00:00
A knowledge check,
00:00
what does REPL stands for?
00:00
I'll give you just a couple of seconds.
00:00
Read execute print loop.
00:00
I don't put loop there because I want to
00:00
specify it is a read execute print,
00:00
and that is being done in a loop.
00:00
Which PEP covers the Zen of Python?
00:00
PEP 20. Which PEP covers the Python conventions?
00:00
I actually don't know that I said it out loud,
00:00
but that is going to be PEP 8.
00:00
Like I said, it's not actually
00:00
terribly, terribly important.
00:00
It's useful and it's good to know and you
00:00
should learn it and you should look up
00:00
>> PEP 8 and read it.
00:00
>> But it's much more important that you write
00:00
functional, easy to read code.
00:00
That's all there is for Lesson 0.
00:00
When you come back to Lesson 1,
00:00
we're going to discuss programming basics, logic.
00:00
We're going to really dig into some
00:00
Boolean logics, some truth tables.
00:00
We're going to have a great time over the course
00:00
of this lesson as
00:00
our knowledge check suggested
00:00
we learned about the history of Python,
00:00
we learned about the fundamental workings of it.
00:00
Of course, we learned that it is much more
00:00
important to be easy to read than it is to be pretty.
00:00
Thank you all very much and I look
00:00
forward to seeing you in the next video.
Up Next