text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
on this use of classes and in it and now
3,557.799
5.32
this ability to raise exceptions when
3,560.96
3.96
something goes wrong inside of the
3,563.119
5.161
initialization so what if user has a
3,564.92
6.04
middle name name middle name and last
3,568.28
4.6
name how would you fix that a good
3,570.96
4.32
question if you wanted the user to if
3,572.88
4.28
you wanted the student to have a first
3,575.28
3.799
name middle name and last name we could
3,577.16
4.199
do this in a bunch of different ways the
3,579.079
4.361
simplest though if Let Me Clear My
3,581.359
3.96
screen here and let me just temporarily
3,583.44
4.2
do this let me propose that the init
3,585.319
5.361
method take in a first argument a middle
3,587.64
5.64
argument and a last argument and then
3,590.68
4.439
what I think I would do down here here
3,593.28
4.64
is ultimately have first equals first
3,595.119
4.44
and then I would do the same thing for
3,597.92
5.6
middle and last so middle and middle and
3,599.559
7.04
then last and last and then what I would
3,603.52
6.2
have to do here is when I actually ask
3,606.599
5.24
the user for their name I might need to
3,609.72
3.76
really go all out I might need to ask
3,611.839
3.441
them first for their first name and
3,613.48
3.8
store that in a variable called First
3,615.28
4.12
and therefore pass in first I might
3,617.28
3.72
similarly need to ask them for their
3,619.4
4.08
middle name and store that in a variable
3,621
4.039
and then pass in a second argument
3,623.48
3.96
middle and then lastly if you will let
3,625.039
4.08
me go ahead and create a third variable
3,627.44
4.08
called last get the input for their last
3,629.119
5.44
name and pass that in as well I could
3,631.52
5.48
instead just use one input and just ask
3,634.559
4.121
them for their whole name so type in
3,637
4.88
David uh men enter or David J ma all
3,638.68
5.359
three of them and maybe I could use
3,641.88
4.56
Python split function maybe a regular
3,644.039
4.04
expression to tease it apart that's
3,646.44
2.919
probably going to be messy because
3,648.079
2.48
there's going to be people who don't
3,649.359
2.921
have just two or three names they might
3,650.559
3.641
have four or five so maybe sometimes
3,652.28
3.88
it's better to have multiple prompts but
3,654.2
3.48
that's not a problem because with a
3,656.16
4.439
class we have the expressiveness to take
3,657.68
4.679
in more arguments if we want we could
3,660.599
3.561
even take a list if we wanted but I
3,662.359
3
think we'd probably want to have even
3,664.16
3
more error checking then not just for
3,665.359
5.2
name but for first and then maybe for
3,667.16
5.199
middle and then maybe for last so it
3,670.559
3.56
just is more and more code though there
3,672.359
3.801
would be ways to perhaps consolidate
3,674.119
4.44
that too let me undo all of that and see
3,676.16
5.159
if there are other questions now on
3,678.559
5.201
classes I assume this is classes are
3,681.319
4
something I might at the beginning of a
3,683.76
3.12
project can I just put them in a
3,685.319
4
different file and import them into my
3,686.88
5.719
project or or or my main code as needed
3,689.319
4.76
absolutely a really good question you
3,692.599
2.921
could imagine wanting to use this
3,694.079
4.28
student class not just in studenty but
3,695.52
4.72
in other files or other projects of
3,698.359
4
yours and absolutely you can create your
3,700.24
5.16
own library of classes by putting the
3,702.359
5.081
student class in your own module or
3,705.4
3.8
package per our discussion in the past
3,707.44
3.56
about libraries more generally and
3,709.2
3.399
absolutely you can do that and later
3,711
3.72
today will we see that we've actually
3,712.599
4.321
been using classes you and I before in
3,714.72
4.119
third party librar so you too can
3,716.92
3.879
absolutely do the same how about one
3,718.839
5.52
more question on classes can you have
3,720.799
6.401
optional variables in classes and two
3,724.359
5.2
can you have your own error names like
3,727.2
4.96
let's be ego and say I want to raise
3,729.559
6.48
Eric error short answer yes so you can
3,732.16
6.28
uh these init functions are just like
3,736.039
3.841
python functions more generally even
3,738.44
2.48
though they're special and that they're
3,739.88
2.64
going to get called automatically by
3,740.92
3.679
python for you but if you want to make
3,742.52
3.519
house optional you could do something
3,744.599
3.041
like this you could give it a default
3,746.039
5.641
value in the init functions uh signature
3,747.64
5.679
so to speak in that first line of code
3,751.68
3.76
on line two and that would allow me to
3,753.319
4.161
not have to pass in house in this case
3,755.44
3.56
I'm going to continue to always pass in
3,757.48
3.319
name and house but you could make things
3,759
3.96
optional and yes to your second question
3,760.799
4.201
if you wanted to have your own error
3,762.96
4.359
message like an Eric error you could
3,765
5.319
actually create your own Eric error
3,767.319
4.921
exception and we'll see in a little bit
3,770.319
3.48
that there's actually a whole Suite of
3,772.24
3.359
exceptions that exist and you too can
3,773.799
5.32