• Because this is a theological conjecture, I think we're shocked by what is almost the heretical daring of what this brother has just said.

    因为这是一个神学猜想,们是被刚才大哥说的异常大胆的话震惊了。

    耶鲁公开课 - 弥尔顿课程节选

  • I'm going to throw it, or raise it, to use the right term to somebody in case they can handle it, but it's a particular kind of exception I might do something like, remind you I have test.

    编译器就要抛出他或者提出它,用正确的描述给某个人来处理,但他的确是一种异常,来做些类似的事情,告诉你有些测试。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • 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.

    这意味着如果在代码中,得到一个这样的异常,能到这里来处理它。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • But if I say turn this into a float, ah it throws a value error exception.

    它就会抛出一个值错误异常了,它会告诉输入了一种错误的值。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • 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调用的发生,并且你不知道这个错误是哪里来的。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Right, so an exception then has this format that I can control as a programmer.

    好的,所以一个异常会有这样的格式,能把他当做一个程序员来控制。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Now what I'm going to try and do is read in a set of values, but I'm going to give a type of value as well as the messages.

    现在要做的是输入一些值,并关注异常,会输入消息以及一种其他的值。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • So I'm going to distinguish in fact between un-handled exceptions, which are the things that we saw there, and handled exceptions. I'm going to show you in a second how to handle them, but let's look at an example.

    所以打算区分开不可处理的异常,以及们刚才看到的,可以处理的异常,一会要给你们演示下如何处理他们,给你们看一个例子。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • So the exceptions are useful when you want to have the ability to say, I expect in general this kind of behavior, but I do know there are some other things that might happen and here's what I'd like to do in each one of those cases. But I do want to make sure that I don't let a value that I'm not expecting pass through.

    所以当你希望有能力说,希望一般是这样的行为,异常是很有用的,但是明白还有一些其它的情况可能发生,希望对每一种情况都这么做,但是跟希望能保证,没有让一个预期之外的情况漏过去。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • 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.

    所以更好的总结下,断言就是你放在那里告诉用户,保证你输入的是这种类型的,但能保证剩下的代码运行正确,异常异常处理做的事,这里有些能预期的异常情况,并且这里有些情况,能尝试处理。

    麻省理工公开课 - 计算机科学及编程导论课程节选

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定