text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
invent those as well let me propose | 3,775.599 | 6.281 |
though that we now introduce one other | 3,779.119 | 5.561 |
aspect of this whereby we try printing | 3,781.88 | 4.679 |
out what a student looks like at the | 3,784.68 | 3.599 |
moment if I scroll back down to my main | 3,786.559 | 3.28 |
function I'm still printing the | 3,788.279 | 3.481 |
student's name and house very manually | 3,789.839 | 3.921 |
I'm going inside of the object doing | 3,791.76 | 3.92 |
student. name and I'm going inside of | 3,793.76 | 3.599 |
the object again and getting student. | 3,795.68 | 4.159 |
house just to see where uh the student | 3,797.359 | 4.68 |
is from but wouldn't it be nice if I | 3,799.839 | 4.081 |
could just print the student like I've | 3,802.039 | 4.681 |
been PR printing for weeks any int or | 3,803.92 | 5.679 |
float or stir or any other data type | 3,806.72 | 4.319 |
well let's see what happens if I just | 3,809.599 | 3.48 |
try printing the student instead of | 3,811.039 | 3.641 |
manually going inside and trying to | 3,813.079 | 3.681 |
create that sentence myself well in my | 3,814.68 | 3.359 |
terminal window let me go ahead and run | 3,816.76 | 3.88 |
python of student. again let me type in | 3,818.039 | 4.961 |
Harry let me type in Gryffindor and we | 3,820.64 | 5.28 |
voila Harry whoa okay main student | 3,823 | 6.48 |
object at o x102 733 | 3,825.92 | 6.56 |
e80 well what is going on well if you | 3,829.48 | 4.52 |
were to run the same code you might | 3,832.48 | 3.079 |
actually see something different on your | 3,834 | 3.44 |
computer in terms of that number but | 3,835.559 | 3.601 |
what you're really seeing is the | 3,837.44 | 4.839 |
underlying representation as a string of | 3,839.16 | 5.04 |
this specific object in particular | 3,842.279 | 3.681 |
you're seeing where in the computer's | 3,844.2 | 6.2 |
memory it is this number o x102 733 e80 | 3,845.96 | 6.079 |
refers to essentially a specific | 3,850.4 | 4.199 |
location in the computer's memory or Ram | 3,852.039 | 4.441 |
that's not really that interesting for | 3,854.599 | 4.561 |
me or you or generally speaking | 3,856.48 | 4.68 |
programmers but it's just a default way | 3,859.16 | 5.52 |
of describing via print what this thing | 3,861.16 | 7.08 |
uh is but I can override this as well it | 3,864.68 | 5.879 |
turns out that there are other special | 3,868.24 | 4.039 |
methods in Python when it comes to | 3,870.559 | 4 |
classes not just underscore underscore | 3,872.279 | 4.241 |
in it underscore underscore But | 3,874.559 | 3.72 |
continuing in that same pattern | 3,876.52 | 4.72 |
underscore underscore stir underscore | 3,878.279 | 5.04 |
underscore so this too is a special | 3,881.24 | 4.76 |
method that if you define it inside of | 3,883.319 | 5.24 |
your class python will just | 3,886 | 5.4 |
automatically call this function for you | 3,888.559 | 5.921 |
anytime some other function wants to see | 3,891.4 | 6.04 |
your object as a string print wants to | 3,894.48 | 5.559 |
see your F your object as a string but | 3,897.44 | 4.399 |
by default if you don't have this method | 3,900.039 | 3.121 |
defined in your class it's going to | 3,901.839 | 3.48 |
print out that very ugly esoteric | 3,903.16 | 4.199 |
Incarnation thereof where it says main. | 3,905.319 | 5.401 |
student object at Ox dot dot dot well | 3,907.359 | 5.281 |
how can I then Define my own stir | 3,910.72 | 4.559 |
function well here back in VSS code let | 3,912.64 | 5.08 |
me propose that I go in and Define not | 3,915.279 | 5.881 |
just underscore underscore uh in it but | 3,917.72 | 5.28 |
let me Define a second function in this | 3,921.16 | 5.879 |
class here as follows decore uncore stir | 3,923 | 6 |
underscore underscore there are indeed | 3,927.039 | 3.681 |
two even though the font in VSS code is | 3,929 | 3.52 |
putting the two underscore so close it | 3,930.72 | 3.599 |
just looks like a longer underscore | 3,932.52 | 3.319 |
there are indeed two there on the left | 3,934.319 | 3.681 |
and the right just like for in it this | 3,935.839 | 5.121 |
one only takes one argument that by | 3,938 | 4.96 |
convention is always called self so that | 3,940.96 | 4.68 |
you have access to it and then indented | 3,942.96 | 5.159 |
below that after a colon I'm going to go | 3,945.64 | 4.8 |
ahead and create a format string and | 3,948.119 | 5.2 |
return it so let me go ahead and return | 3,950.44 | 4.399 |
how about something gener generic first | 3,953.319 | 3.72 |
like a student so I'm not going to | 3,954.839 | 4.28 |
bother even trying to figure out what | 3,957.039 | 3.681 |
this Student's name or house is I'm just | 3,959.119 | 4.16 |
going to always return a student let me | 3,960.72 | 5.399 |
go back now to my earlier code which has | 3,963.279 | 6.04 |
print student on line 16 Let Me Clear My | 3,966.119 | 5.48 |
terminal window and rerun python of | 3,969.319 | 4.881 |
studenty enter type in Harry type in | 3,971.599 | 4.68 |
Gryffindor last time I saw that very | 3,974.2 | 4.159 |
cryptic output this time I see more | 3,976.279 | 4.84 |
generically a student you know more | 3,978.359 | 5.161 |
readable but not very enlightening which | 3,981.119 | 6.44 |
student is this well notice that the uh | 3,983.52 | 6.92 |
double underscore stir method takes in | 3,987.559 | 5.72 |
this self argument by default it's just | 3,990.44 | 5.679 |
the way the python authors designed this | 3,993.279 | 5.481 |
method it will always be passed a | 3,996.119 | 5.68 |
reference to the current student object | 3,998.76 | 5.079 |
what do I mean by that when this line of | 4,001.799 | 5 |
code on line six is called print because | 4,003.839 | 4.96 |
it's hoping it's going to get a string | 4,006.799 | 4.161 |
is going to trigger the underscore | 4,008.799 | 4.76 |
uncore stir underscore uncore method to | 4,010.96 | 3.72 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.