text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
change in it except to get rid of this
5,696.199
5.321
duplicate error checking now because
5,698.84
6.44
again if I use self. name equals here
5,701.52
5.96
and self. house equals here with no
5,705.28
4.56
underscore both of those assignments are
5,707.48
4.8
going to go through my two Setter
5,709.84
4.48
functions now before we run this let me
5,712.28
3.839
go ahead and remove this adversarial
5,714.32
3.319
code which we know won't work because
5,716.119
3.56
we're catching it let me go back down to
5,717.639
3.801
my terminal window and run python of
5,719.679
4.321
studenty enter let's type in Harry let's
5,721.44
4.4
type in Gryffindor and that seems to
5,724
4.159
work let's try though again to run
5,725.84
4.359
python of studenty with Harry from
5,728.159
5.441
number four private drive this will not
5,730.199
6.241
work a value error with invalid house
5,733.6
4.079
because that's not one of the four
5,736.44
3.279
Hogwarts houses and now for good measure
5,737.679
3.641
let's run it one more time and let's not
5,739.719
3.641
even give it a name let's just hit enter
5,741.32
4.12
when prompted I can type anything for
5,743.36
3.4
the house I'll go ahead and still give
5,745.44
3.64
it Gryffindor enter now we get another
5,746.76
5.16
value error but this one is for missing
5,749.08
5.48
name so we seem now to have all the more
5,751.92
4.799
of a defense mechanism in place to
5,754.56
4.28
ensure that name is as we expect it's
5,756.719
4.361
got to have some value that's not blank
5,758.84
4.04
and houses as we expect it's got to have
5,761.08
5
one of those four values but at the risk
5,762.88
5.319
of bursting everyone's bubble and making
5,766.08
4.48
you wonder why did we just go through
5,768.199
6.281
all of that unfortunately python really
5,770.56
7.28
focuses on conventions not hard
5,774.48
5.96
constraints and by that I mean this if I
5,777.84
5.2
go back into my function after I've
5,780.44
5.679
gotten a student on line 30 and I try to
5,783.04
5.159
adversarially do something like this
5,786.119
4.161
student. housee equals quote unquote
5,788.199
5.161
number four Private Drive we know this
5,790.28
5.6
won't work because my Setter for house
5,793.36
5
is going to catch this watch again
5,795.88
3.72
python of
5,798.36
3.799
studenty uh let's type in Harry let's
5,799.6
4.44
type in Gryffindor which will at least
5,802.159
4.96
pass our check that's induced by in it
5,804.04
6.679
but line 31 is going to trigger the same
5,807.119
5.12
Setter to be be called and we're going
5,810.719
3.92
to raise a value error saying invalid
5,812.239
5.201
house unfortunately and if some of you
5,814.639
4.48
are already thinking a little
5,817.44
3.84
adversarially tragically look what you
5,819.119
5.961
can do you can change house to be uncore
5,821.28
6.359
house why well the instance variable is
5,825.08
6.159
now called underscore house the property
5,827.639
5.761
is called house no underscore but the
5,831.239
4.48
underlying attribute implemented as an
5,833.4
5.16
instance variable is still called
5,835.719
6.121
underscore house and tragically python
5,838.56
6.559
of student. py let's type in Harry let's
5,841.84
5.6
type in Gryffindor which is correct but
5,845.119
5.401
Watch What Happens now oh my God we
5,847.44
6.44
slipped through so what was the point of
5,850.52
5.48
all of this emphasis from me on doing
5,853.88
4.52
things the right way the pythonic way by
5,856
4.48
having this getter and Setter well
5,858.4
4.799
unlike languages like Java that just
5,860.48
5.119
prevent you from doing things like this
5,863.199
4.361
python itself allows you to specify that
5,865.599
3.961
certain instance variables can be public
5,867.56
4.2
and accessible to anyone's code or
5,869.56
4.84
protected or private which means that no
5,871.76
4.2
one else should be able to change these
5,874.4
4.48
values in the world of python it's just
5,875.96
5.159
the honor System it's not baked into the
5,878.88
3.92
language itself that there's a notion of
5,881.119
3.52
visibility public or private or even
5,882.8
3.919
somewhere in between protected instead
5,884.639
3.52
you're on the honor System and the
5,886.719
4.801
convention generally is if a instance
5,888.159
6.161
variable starts with an underscore
5,891.52
4.84
please don't touch it like just don't
5,894.32
3.96
like that's on you if you touch that
5,896.36
4
variable and break things the underscore
5,898.28
3.72
is meant to signify a convention that
5,900.36
3.759
this is meant to be private but it
5,902
3.56
really just means please don't touch
5,904.119
2.52
this sometimes if there's two
5,905.56
2.88
underscores which you can use two that's
5,906.639
3.52
an even greater effort by programmers to
5,908.44
3.719
say really don't touch this but
5,910.159
3.56
technically speaking there's nothing
5,912.159
4.161
stopping you or me from circumventing
5,913.719
5
all of these mechanisms these properties
5,916.32
3.96
these Getters and Setters we're
5,918.719
3.561
ultimately just on the honor System not
5,920.28
4.359
to do so when we see instance variables
5,922.28
4.8
prefixed with one or perhaps even two
5,924.639
4.881
underscores all right so this is a lot
5,927.08
4.119