What does that say? It says if in the code up here I get an exception of that sort, I'm going to go to this place to handle it.
这意味着如果在代码中,我得到一个这样的异常,我能到这里来处理它。
I think I can handle it.
我觉得我能处理。
But I want to stress again, as long as I do the base case right and my inductive or recursive step reduces it to a smaller version of the same problem, the code will in fact converge and give me out an answer.
就开心的去做吧,但是我想再次强调,只要基础事件处理正确而我的递归,或递推步骤能把它简化为更简单的同类问题,那么这段代码就可以收敛。
The flip side is there are going to be a couple of lectures now where it is not going to be on the test, so I think you will deal with it.
现在这种对立面将是,一些现在的课程,这些不会在考试上出现,所以我想你能处理好的。
My secretary is able to process that command, my computer cannot process that command.
我的秘书都能做到,我的电脑却不能处理这项指令。
Can I do this?
我能这样处理么?
Well some things I can actually expect may happen and I want to handle them.
我能预期的一些事情可能会发生,我希望能处理他们。
I if I go over here, and I say float of three, it's going to do the conversion.
用float来处理3,它将能完成装换,但是如果我吧这个转化为浮点数。
So, summarizing better, assert is something you put in to say to the user, make sure you're giving me input of this type, but I'm going to guarantee you the rest of the code works correctly. Exceptions and exception handlers are saying, here are the odd cases that I might see and here's what I'd like to do in those cases in order to try and be able to deal with them.
所以更好的总结下,断言就是你放在那里告诉用户,保证你输入的是这种类型的,但我能保证剩下的代码运行正确,异常和异常处理做的事,这里有些我能预期的异常情况,并且这里有些情况,我能尝试处理。
应用推荐