text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
to be a class called student let me go | 1,960.919 | 5.841 |
ahead and rerun python of student. by | 1,963.72 | 5 |
enter let's type in Harry's name as | 1,966.76 | 3.68 |
before let's put him in Gryffindor | 1,968.72 | 4.079 |
crossing our fingers as we often do and | 1,970.44 | 5.199 |
Harry is indeed from | 1,972.799 | 5.321 |
Gryffindor what the though have I done | 1,975.639 | 4.04 |
let's introduce one other bit of | 1,978.12 | 4.799 |
terminology here it turns out that I can | 1,979.679 | 5.96 |
create a class using that class keyword | 1,982.919 | 5.041 |
but anytime you use a class you're | 1,985.639 | 4.441 |
creating what are called objects and | 1,987.96 | 3.92 |
here is the word objects as an | 1,990.08 | 4.8 |
objectoriented programming or oop let me | 1,991.88 | 4.759 |
go back to my code here and even though | 1,994.88 | 3.44 |
I haven't really implemented much of it | 1,996.639 | 3.481 |
at all I literally just left it with a | 1,998.32 | 4.239 |
dot dot dot that's enough code lines one | 2,000.12 | 4.88 |
and two to just invent a new data type | 2,002.559 | 5.041 |
called student capital s that may or may | 2,005 | 4.279 |
not have some future functionality as | 2,007.6 | 3.959 |
well that's enough to create a class | 2,009.279 | 5.081 |
what though am I doing on line 11 on | 2,011.559 | 5.561 |
line 11 what I'm technically doing is | 2,014.36 | 6 |
creating an object of that class so this | 2,017.12 | 5.64 |
too is another term of art you create | 2,020.36 | 5.24 |
objects from classes so if we go back to | 2,022.76 | 4.399 |
that metaphor that a class is like a | 2,025.6 | 4.16 |
blueprint for a house or a class is like | 2,027.159 | 5.64 |
a mold an object is when you use that | 2,029.76 | 5.399 |
blueprint to build a specific house or | 2,032.799 | 4.201 |
something that comes out of in plaster | 2,035.159 | 3.961 |
the mold when you actually use that mold | 2,037 | 5.32 |
to create such an object so a class is | 2,039.12 | 5.799 |
again the definition of a new data type | 2,042.32 | 5.52 |
the object is the Incarnation of or | 2,044.919 | 5.68 |
technically instantiation of and another | 2,047.84 | 4.999 |
term for objects would actually be an | 2,050.599 | 4.921 |
instance you have instances of classes | 2,052.839 | 4.481 |
as well so that's a lot of vocabulary | 2,055.52 | 3.159 |
but at the end of the day it just boils | 2,057.32 | 3.2 |
down to this you can Define your own | 2,058.679 | 3.96 |
class which is really your own data type | 2,060.52 | 4.24 |
you can then store attributes inside of | 2,062.639 | 4.361 |
it using this dot notation here and and | 2,064.76 | 3.56 |
then you can access those same | 2,067 | 4.28 |
attributes using Code like this here and | 2,068.32 | 5.72 |
now I have a proper student data type | 2,071.28 | 4.52 |
and I don't have to kind of hack | 2,074.04 | 3.52 |
something together using a tuple or a | 2,075.8 | 4.039 |
list or even a dictionary I now have a | 2,077.56 | 4.88 |
proper data type called student that the | 2,079.839 | 5.28 |
authors of python didn't give me I gave | 2,082.44 | 6.679 |
myself any questions now on classes this | 2,085.119 | 6.081 |
new keyword class or this idea of these | 2,089.119 | 5.28 |
objects or instances thereof is the | 2,091.2 | 8 |
class object mut or immutable a good | 2,094.399 | 6.321 |
question and we've clearly laid the | 2,099.2 | 3.12 |
stage for having that conversation about | 2,100.72 | 3.639 |
every data type now we will see that | 2,102.32 | 4.759 |
they are mutable but you can make them | 2,104.359 | 4.921 |
immutable so you can get the best of | 2,107.079 | 4.52 |
both worlds Now by writing some actual | 2,109.28 | 3.88 |
code and we'll write more code than the | 2,111.599 | 3.601 |
dot dot dot in just a bit other | 2,113.16 | 4.28 |
questions on classes or these objects | 2,115.2 | 4.2 |
thereof then what would be the | 2,117.44 | 4.679 |
properties of those glasses uh so at the | 2,119.4 | 4.52 |
moment the properties of or the | 2,122.119 | 3.48 |
attributes of as I've been calling them | 2,123.92 | 4.56 |
thus far would just be name and house it | 2,125.599 | 4.361 |
turns out that there may very well be | 2,128.48 | 3.879 |
other attributes built into classes that | 2,129.96 | 4.44 |
we may see before long but for now the | 2,132.359 | 3.681 |
only two attributes that I care about | 2,134.4 | 4.04 |
are the ones that I myself created | 2,136.04 | 5.2 |
namely name and house are again what I | 2,138.44 | 4.639 |
would call attributes and in a little | 2,141.24 | 3.08 |
bit we're going to start calling those | 2,143.079 | 3.04 |
same attributes more technically | 2,144.32 | 4.56 |
instance variables name and house as | 2,146.119 | 4.841 |
I've presented them here in vs code are | 2,148.88 | 4.88 |
really just variables called name and | 2,150.96 | 6.359 |
called house inside of an object object | 2,153.76 | 7.12 |
whose type is student all right so what | 2,157.319 | 5.561 |
more can we do with these classes well | 2,160.88 | 4.32 |
again online 11 is where we're | 2,162.88 | 5.239 |
instantiating an object of the student | 2,165.2 | 5.159 |
class and assigning it to a student | 2,168.119 | 4.281 |
variable we're then adding attributes | 2,170.359 | 4.321 |
name and house respectively on lines 12 | 2,172.4 | 4.36 |
and 13 currently both of those have | 2,174.68 | 3.96 |
values that are technically strings or | 2,176.76 | 3.4 |
stirs because that's what the return | 2,178.64 | 3.52 |
value of input is but those attributes | 2,180.16 | 3.72 |
values could actually be any data type | 2,182.16 | 3.199 |
we're just keeping things simple and | 2,183.88 | 3.32 |
focusing on defining students in terms | 2,185.359 | 4.361 |
of two strings name and house and then | 2,187.2 | 5 |
on line 14 we're returning that variable | 2,189.72 | 4.8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.