text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
that i have too few but i'm also going | 2,092.399 | 4.72 |
to see that same exception at the very | 2,094.8 | 3.84 |
top of my terminal windows output | 2,097.119 | 3.121 |
there's my error message too few | 2,098.64 | 4 |
arguments but again on line 10 i blindly | 2,100.24 | 5.359 |
proceed to still index into my list at | 2,102.64 | 6 |
location one which does not exist so it | 2,105.599 | 4.881 |
turns out there's a better way to handle | 2,108.64 | 3.199 |
errors like this especially if you're | 2,110.48 | 3.68 |
writing a program in python that's just | 2,111.839 | 4.641 |
meant to run briefly and then exit | 2,114.16 | 4.959 |
anyway but maybe we could start to exit | 2,116.48 | 5.599 |
prematurely if the program itself just | 2,119.119 | 4.801 |
can't proceed if the user has not given | 2,122.079 | 3.841 |
us the data we want perhaps we should | 2,123.92 | 4.96 |
just exit the program earlier than we | 2,125.92 | 5.04 |
might otherwise so let me go ahead and | 2,128.88 | 3.84 |
do this let me go ahead and remove my | 2,130.96 | 3.68 |
comments so as to focus only on the code | 2,132.72 | 5.44 |
here and let me propose that instead of | 2,134.64 | 6 |
just printing quote unquote too few | 2,138.16 | 4.32 |
arguments i'm going to use one other | 2,140.64 | 4 |
function that comes with the sys module | 2,142.48 | 5.44 |
i'm going to go ahead and call sys.exit | 2,144.64 | 4.959 |
and as the name suggests it's going to | 2,147.92 | 3.84 |
do exactly that with the systems help | 2,149.599 | 4.561 |
it's going to exit my program then and | 2,151.76 | 5.68 |
there on line four why is that okay well | 2,154.16 | 4.88 |
if you gave me too few arguments i have | 2,157.44 | 3.6 |
nothing more to say to you the user i | 2,159.04 | 4.319 |
might as well exit a bit prematurely and | 2,161.04 | 4.319 |
i can do this as well on line six let's | 2,163.359 | 3.361 |
go ahead and not just print that but | 2,165.359 | 3.841 |
sys.exit quote-unquote too many | 2,166.72 | 4.24 |
arguments print out that message and | 2,169.2 | 3.6 |
just exit right there | 2,170.96 | 4 |
now i can trust that by the time i get | 2,172.8 | 5.279 |
to line eight every error condition has | 2,174.96 | 5.44 |
been checked for and so it's safe for me | 2,178.079 | 5.52 |
to assume that there is in fact an item | 2,180.4 | 6.8 |
at location one in sys.rgv so let me go | 2,183.599 | 5.361 |
ahead now and run this | 2,187.2 | 4.879 |
python of name dot pi enter too few | 2,188.96 | 5.44 |
arguments but i'm back at my prompt | 2,192.079 | 4.481 |
nothing more has happened let me run it | 2,194.4 | 4.8 |
again python of name dot pi david malen | 2,196.56 | 5.279 |
with no quotes enter too many arguments | 2,199.2 | 5.12 |
is now printed here finally python of | 2,201.839 | 5.841 |
name dot pi just david enter hello my | 2,204.32 | 6.08 |
name is david so we have then insists | 2,207.68 | 4.48 |
two forms of functionality now we have | 2,210.4 | 4.08 |
access to this variable sys.rgv this | 2,212.16 | 4.4 |
argument vector that gives me all of the | 2,214.48 | 3.599 |
words that were typed at the prompt | 2,216.56 | 3.76 |
including the program's own file name | 2,218.079 | 4 |
and it turns out if we read further in | 2,220.32 | 3.12 |
the documentation there's an exit | 2,222.079 | 3.28 |
function that can take different types | 2,223.44 | 4.159 |
of inputs but if i pass it a string like | 2,225.359 | 4.401 |
this it will indeed print that string | 2,227.599 | 4.721 |
for me and then exit from my program | 2,229.76 | 3.92 |
then in there | 2,232.32 | 4.24 |
questions now on exiting from programs | 2,233.68 | 4.159 |
like this | 2,236.56 | 3.84 |
to be clear all of this time once python | 2,237.839 | 4.481 |
gets to the bottom of your file it's | 2,240.4 | 3.679 |
going to exit anyway so i'm using | 2,242.32 | 4 |
sys.exit now just to make sure that i | 2,244.079 | 5.121 |
exit earlier than otherwise um my | 2,246.32 | 5.84 |
question is about the cis that are | 2,249.2 | 4.399 |
our v | 2,252.16 | 4.64 |
so is that capable of accepting or | 2,253.599 | 6.401 |
taking multiple elements at once let's | 2,256.8 | 4.64 |
say for example | 2,260 | 6.32 |
a python name that pi david malin i'm | 2,261.44 | 7.919 |
a male uh 20 years old and if let's say | 2,266.32 | 5.92 |
i only want to access your name which is | 2,269.359 | 5.601 |
at the first index and then your | 2,272.24 | 3.839 |
your | 2,274.96 | 3.52 |
your age is brought say at the sixth | 2,276.079 | 4.121 |
index can i say | 2,278.48 | 3.28 |
cis.rb | 2,280.2 | 2.919 |
one | 2,281.76 | 4.24 |
and another one for six to access what i | 2,283.119 | 4 |
just want | 2,286 | 4.32 |
is that possible for cis harvey | 2,287.119 | 5.681 |
uh short answer yes i think if i | 2,290.32 | 3.759 |
understand your question correctly | 2,292.8 | 3.2 |
whereby you're proposing to have many | 2,294.079 | 3.601 |
words at the end of the command and you | 2,296 | 3.52 |
want to access those individual words | 2,297.68 | 4.56 |
absolutely at some point it gets a | 2,299.52 | 4.64 |
little fragile i would say if you're | 2,302.24 | 4.08 |
typing so many words at the prompt that | 2,304.16 | 5.199 |
the order really matters and so it turns | 2,306.32 | 4.4 |
out there's a lot of programs and | 2,309.359 | 2.801 |
there's functionality in python that can | 2,310.72 | 4.16 |
allow you to provide those values like | 2,312.16 | 5.04 |
name or age or any number of other | 2,314.88 | 6.239 |
fields in any order you want but pass in | 2,317.2 | 5.919 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.