text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
time we just didn't call it a class | 6,398.8 | 5 |
until today I can similarly do this one | 6,400.92 | 5 |
explicitly instead of two curly braces | 6,403.8 | 3.72 |
let's write out dict with two | 6,405.92 | 3.239 |
parentheses now we have a lot of | 6,407.52 | 4.199 |
parentheses again like with list but | 6,409.159 | 4.281 |
this is just making even more clear that | 6,411.719 | 4.561 |
the type of a dict object is indeed the | 6,413.44 | 6.36 |
class dict itself so this is to say that | 6,416.28 | 5.48 |
as new as a lot of today's IDE and | 6,419.8 | 4 |
syntax might be you've actually been | 6,421.76 | 4.04 |
using it perhaps unbeknownst to you for | 6,423.8 | 4.52 |
weeks now we now just have terminology | 6,425.8 | 4.28 |
to describe what it is we've been doing | 6,428.32 | 3.919 |
all this time and you now have the | 6,430.08 | 4.36 |
expressiveness with some practice to | 6,432.239 | 4.801 |
create your own classes inside of which | 6,434.44 | 4.44 |
are your own instance variables perhaps | 6,437.04 | 3.76 |
wrapped with those properties and your | 6,438.88 | 5.64 |
own instance methods but it turns out | 6,440.8 | 5.72 |
there's other types of methods in the | 6,444.52 | 4.199 |
world thus far I've been deliberate in | 6,446.52 | 4.44 |
calling all of our variables instance | 6,448.719 | 5 |
variables and all of our methods uh | 6,450.96 | 5.48 |
instance methods it turns out there's | 6,453.719 | 6.041 |
other types of variables and methods out | 6,456.44 | 5.759 |
there and one of those is called class | 6,459.76 | 5.68 |
methods it turns out that sometimes it's | 6,462.199 | 6.4 |
not really necessary or sensible to | 6,465.44 | 6.04 |
associate a function with objects of a | 6,468.599 | 6.401 |
class but rather with the class itself | 6,471.48 | 5.92 |
an instance or an object of a class is a | 6,475 | 5 |
very specific Incarnation thereof again | 6,477.4 | 4.44 |
on that neighborhood that has a lot of | 6,480 | 3.56 |
identical looking buildings but they're | 6,481.84 | 3.16 |
all a little bit different because of | 6,483.56 | 3.84 |
different paint and such sometimes you | 6,485 | 5.04 |
might have functionality related to each | 6,487.4 | 5.239 |
of those houses that isn't distinct or | 6,490.04 | 4.48 |
unique for any of the houses it's | 6,492.639 | 3.801 |
functionality that's going to be exactly | 6,494.52 | 4.719 |
the same no matter the house in question | 6,496.44 | 4.44 |
same in the world of object oriented | 6,499.239 | 3.521 |
programming sometimes you want some | 6,500.88 | 3.6 |
functionality some action to be | 6,502.76 | 4 |
associated with the class itself no | 6,504.48 | 5.32 |
matter what the specific objects own | 6,506.76 | 5.919 |
values or instance variables are and for | 6,509.8 | 5.64 |
that we have a keyword called at class | 6,512.679 | 5.201 |
method this is another decorator really | 6,515.44 | 4.759 |
another function that you can use to | 6,517.88 | 5.6 |
specify that this method is not by | 6,520.199 | 5.681 |
default implicitly an instance method | 6,523.48 | 4.52 |
that has access to self the object | 6,525.88 | 4.359 |
itself this is a class method that's not | 6,528 | 3.96 |
not going to have access to self but it | 6,530.239 | 4.241 |
does know what class it's inside so what | 6,531.96 | 4.159 |
do I mean by this well let me go back to | 6,534.48 | 4 |
vs code here and let me propose that we | 6,536.119 | 5 |
create a new file this time implementing | 6,538.48 | 4.84 |
the notion of a the Sorting Hat from the | 6,541.119 | 4.241 |
World of Harry Potter as well to stay on | 6,543.32 | 3.799 |
theme I'm going to go ahead and run code | 6,545.36 | 4.56 |
of hat. py and in hat. py let's | 6,547.119 | 4.681 |
implement the notion of this Sorting Hat | 6,549.92 | 3.96 |
if unfamiliar in the books and in the | 6,551.8 | 5.04 |
films there is literally a pointy hat | 6,553.88 | 4.96 |
that when a student put it on their head | 6,556.84 | 4.839 |
that Sorting Hat so to speak decides | 6,558.84 | 4.48 |
what house the student is in whether | 6,561.679 | 3.761 |
it's Gryffindor or something else so | 6,563.32 | 4.12 |
let's Implement and code this notion of | 6,565.44 | 5.04 |
a Sorting Hat such that when we pass to | 6,567.44 | 4.84 |
the Sorting Hat the name of a student | 6,570.48 | 4.04 |
like quote unquote Harry this Sorting | 6,572.28 | 4.56 |
Hat implemented in code will tell us | 6,574.52 | 5.199 |
what house that student should be in all | 6,576.84 | 5 |
right well let's go ahead and do this in | 6,579.719 | 4.96 |
hat. py first let's go ahead and define | 6,581.84 | 6.279 |
a class called hat and then let's get | 6,584.679 | 5.121 |
back to implementing it itself and I | 6,588.119 | 3.04 |
find this to be a helpful technique not | 6,589.8 | 3.28 |
just with teaching but when writing code | 6,591.159 | 4.321 |
like I know I want a ha class I don't | 6,593.08 | 4.119 |
necessarily know what I want it to do | 6,595.48 | 3 |
yet so I'm going to create this sort of | 6,597.199 | 3.44 |
placeholder dot dot dot so I'll come | 6,598.48 | 4.84 |
back to that let's now try to use this | 6,600.639 | 4.641 |
class as though it existed and from | 6,603.32 | 4.76 |
there I perhaps can realize exactly what | 6,605.28 | 4.399 |
functionality that class needs to have | 6,608.08 | 3.96 |
to support my use case let me go ahead | 6,609.679 | 4.04 |
and create a variable called hat in all | 6,612.04 | 5.48 |
lower case and instantiate a hat object | 6,613.719 | 6.52 |
so no matter what the Hat class ends up | 6,617.52 | 5.199 |
looking like this is the common Syntax | 6,620.239 | 5 |
for instantiating an object of a certain | 6,622.719 | 5.361 |
class in the past we saw student all | 6,625.239 | 5.88 |
lowercase equals Capital student open | 6,628.08 | 4.8 |
parenthesis closed parenthesis and then | 6,631.119 | 3.401 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.