text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
define a main function in here too just
4,311.04
4
for the purposes of testing and i'm
4,313.36
2.96
going to go ahead and define a main
4,315.04
4
function that simply does a couple of
4,316.32
6.64
tests for instance it calls uh hello of
4,319.04
6.32
quote-unquote worlds shall we say and
4,322.96
4.64
then it's going to call goodbye of quote
4,325.36
4.56
unquote world as well and hopefully what
4,327.6
3.599
i'll see on the screen then is hello
4,329.92
3.12
world and goodbye world when i run this
4,331.199
3.761
program of course as always i need to
4,333.04
3.84
explicitly tell python to call that
4,334.96
3.6
function so i'm going to call main at
4,336.88
3.44
the very bottom of this file all right
4,338.56
4.96
let's try it out python of sayings.pie
4,340.32
5.44
enter and indeed i see hello world and
4,343.52
3.76
goodbye world and so i think it's
4,345.76
3.28
reasonable for me to assume that these
4,347.28
3.919
functions albeit simple are pretty
4,349.04
4.32
correct at this point but now suppose
4,351.199
4
that i want to use these functions as
4,353.36
3.44
though i've indeed created my own
4,355.199
4.48
library my own python module that makes
4,356.8
4.72
available a hello function for me or
4,359.679
3.52
anyone else who wants to use it or a
4,361.52
3.84
goodbye function as well well let me go
4,363.199
5.281
ahead and open up again say.pi but start
4,365.36
5.28
fresh and rather than have the cow say
4,368.48
4.96
anything let me go ahead and have my own
4,370.64
5.2
library do the talking so i'm going to
4,373.44
4.88
go ahead and as before import sys so
4,375.84
3.92
that i have access to command line
4,378.32
4.32
arguments and from my own module called
4,379.76
5.439
sayings i'm going to import hello so
4,382.64
4.24
because i created a file called
4,385.199
3.281
sayings.pi
4,386.88
4.16
i can say from sayings and it's inferred
4,388.48
4.56
by python that i mean sayings.pi at
4,391.04
3.679
least in this current directory but i
4,393.04
3.52
specifically going to import just one of
4,394.719
4.321
the functions for now namely hello and
4,396.56
4.32
now i can do something like this if the
4,399.04
4.24
user obliges by giving me two command
4,400.88
4.4
line arguments which i can check by just
4,403.28
4.56
checking the length of sys.org v i'm
4,405.28
4.879
going to then go ahead and call this new
4,407.84
4.92
hello function passing is its input
4,410.159
4.881
assist.rgv bracket1 which should
4,412.76
3.88
hopefully be the person's name which i'm
4,415.04
2.96
going to expect them to type at the
4,416.64
3.28
prompt so here we go i'm going to go
4,418
4.159
down to my terminal window run python of
4,419.92
5.44
say.pi and my own name because i want my
4,422.159
4.56
own name to end up in the command line
4,425.36
3.04
arguments and therefore be part of the
4,426.719
3.601
hello so when i hit enter in just a
4,428.4
4
moment i should hopefully see hello
4,430.32
5.28
comma david so here we go enter
4,432.4
6.48
and huh i see hello world goodbye world
4,435.6
6.72
and then i see hello david so
4,438.88
6.24
why is this happening well it turns out
4,442.32
4
even though i've done everything
4,445.12
4.48
according to our own past practice it's
4,446.32
5.76
not really the right way to go about
4,449.6
5.04
calling maine after all if i'm blindly
4,452.08
4.24
calling main here at the bottom of my
4,454.64
3.12
file that means whenever this file is
4,456.32
3.52
loaded by python main is going to get
4,457.76
4.64
called and unfortunately that's true
4,459.84
5.04
even if i'm importing this file or just
4,462.4
4.64
a function from this file as i am here
4,464.88
4.799
in my say.pi program this is to say on
4,467.04
5.199
mine three here when i say from sayings
4,469.679
4.641
import hello this effectively tells
4,472.239
4.881
python to go find that module sayings.pi
4,474.32
4.8
read it from top to bottom left to right
4,477.12
3.76
and then import specifically the hello
4,479.12
3.76
function unfortunately by the time
4,480.88
3.76
python has read the file from top to
4,482.88
4.24
bottom left to right that last line of
4,484.64
5.039
code recall is to call main main gets
4,487.12
5.2
called no matter what so really the
4,489.679
4.961
right way to go about using a main
4,492.32
4.16
function which does solve that problem
4,494.64
3.36
of ensuring that we can order our
4,496.48
3.28
functions however we want and all the
4,498
3.6
functions will be defined at the time
4,499.76
3.72
they're invoked i shouldn't be
4,501.6
3.76
unconditionally calling main at the
4,503.48
3.64
bottom of this or really any of my
4,505.36
3.76
programs i should instead use this
4,507.12
4.64
technique i should say if underscore
4,509.12
5.039
underscore name underscore underscore
4,511.76
4.8
equals equals quote unquote underscore
4,514.159
4.881
underscore main underscore underscore
4,516.56
5.2
close quote then and only then should
4,519.04
5.52
you actually call main well it turns out
4,521.76
4.64
that this variable is a special symbol
4,524.56
4.159
in python underscore underscore name
4,526.4
4.48
underscore underscore and notice that vs
4,528.719
3.921