If I do this, try and get the 10th element of a list that's only eight long. I get what looks like an error, but it's actually throwing an exception.
如果我来这么做,试着去取长度为8的列表的第十个元素,我貌似能得到一个错误。
So generally, if you don't get an error message in a command line environment like this, that's good.
一般来说,如果你在命令行界面,没有收到错误信息,那就是好消息。
I'm much better having an exception get handled at the time of input than to let that prop -- that value rather propagate through a whole bunch of code until eventually it hits an error 17 calls later, and you have no clue where it came from.
不是我期望的格式,这时我最好有一个异常处理,而不是让其传下去,这个值传到代码的整个分支,最终会导致一个错误17调用的发生,并且你不知道这个错误是哪里来的。
If it's just an addition error, the recitation instructor has authority to make that adjustment.
如果那只是附加错误,导师有权利,更正成绩。
> David: An error message of some sort like "file not found" or "commands not found."
>,大卫:会出现一个错误信息像“没找到文件“,或“没找到命令“
Before I type in that expression, I get an error, right?
在我输入表达式之前,出现一个错误,对吧?
Let's go the other direction. And yes, I guess I'd better say s not 2, or we're going to get an error here. Again, in twenty-three checks.
这里我得说不能是2,否则要报错了,再一次,调用了23次,在这个例子里,它从尾部开始。
We have an error somewhere.
如果进行数学计算对的话。
> An error.
>,会发生错误。
So this is a classic error. I've not made a copy of the list. I've got an alias of the list.
这是个相当经典的错误,在这里我并没有得到数组的。
And this, in my mind, should have been an error.
这个地方我认为应该是一个错误。
You caught me making an error.
你发现我出错了。
I spotted an error here, I could have spotted it by running it on different test sets, and using prints things, another way of doing it, but this idea of at least simulating it on simple examples lets you check a couple of important questions.
操作么?我在这里发现了一个错误,我也可以通过运行不同的测试集,或者运用print声明来发现这个错误,但是至少应该用简单的例子来手工模拟下,代码的思想可以让你,对一些很重要的问题进行检验。
The exception is right there. It's an index error, that is it's trying to do something going beyond the range of what this thing could deal with.
但他事实上抛出一个异常,异常就在这里,这是一个下标错误,它是试图去取超出范围的元素造成的。
That says it's in here. It's in this tri-block. It raised an exception, but it wasn't and I O error.
这在这里它是一个try程序块,它报出异常,但他不是io错误。
An exception is called a name error exception.
一个被称作命名错误的异常。
Give you an example of a syntax error.
返回了一个语法错误的例子。
应用推荐