Why? Because that block identifies a set of things that I'm going to do if the test is true.
为什么呢?这是因为这一块指令,指定了一系列的要进行的操作,如果测试为真的话。
On Thursday, we'll look at why that allows you to do lots of things more conveniently than you can do without mutation.
周四我们会探讨下,为什么这种可变性会让你,在进行很多操作的时候方便了许多。
So thankfully, modern operating systems allow you to put parts of files here, parts of your file here, parts of your file here, but the end result is that your files get fragmented.
因此,谢天谢地,现代操作系统允许你,把这里的文件进行分块,在这里存一部分,在那儿存一部分,但最后的结果是你的文件变成了分片的。
I mean, to the extent that you're making these short-term bets against your long-term policy, it requires trading and trading is expensive.
我的意思是,在长期策略下进行短期操作,就需要进行交易,而交易是昂贵的
We can do the same thing for the other observed kinetic energy.
我们还可以对观测到的,其它动能进行同样的操作。
All right, so now let's see how we execute it, and do the calculations that allow us to calculate this. So, one, what's delta H in step one?
好,现在我们看看怎样操作它,怎样进行计算,第一步,步骤I的ΔH是多少?
One of the advantages of this is, that I don't have to worry about explicitly updating my variable. That happens for me automatically.
这样继续下去,这样做的一个优点是,我不用为更新变量来发愁了,程序会自动的为我进行这个操作,这一点很好。
It could be, preconditions I want to have on input It could be, explanations of specific things you're doing.
也可以是我对输入的预期是什么,也可以是,对代码,正在进行的特定操作的解释。
It actually lets you see how to get access to that pointer so you know what you're referring to.
怎么来取得指针,以得知在对什么进行操作,但是这是个简单的设计决定。
And so I'm going to go back to this idea of a class, and let's build the first of these, and that is shown right here on this piece of your handout.
你把半径加到一起,你不会把角度加到一起,你需要再笛卡尔坐标下,进行这个操作,那么我这里在讲的就是。
Linear algorithms tend to be things where, at one pass-through, you reduce the problem by a constant amount by one. If you reduce it by two, 1 it's going to be the same thing.
有问题么?,线性复杂度的算法,当进行了一个,常量级步数的操作的时候,将问题的规模缩小了一个。
So it makes sense to be able to say, look for many methods I do want to have a way of doing comparison, and I don't have to remember, at top level, what the name of the comparison method was.
所有我需要的对象进行操作,那么就可以这么说了,我想要在很多方法里面,去找做比较的方法,我并不需要记住,每一个比较的方法的名字。
Give you some examples. What have we talked about? We've talked about things like using comments to highlight what you're doing in the code, to make it easier to debug.
给大家举些例子,我们一直在强调什么来着?,我们讲过要用注释来说明,你在代码中进行的操作,以便于调试。
And then I could do things like again, say, okay having done, that let me just run it here, run that, so I've now got polar point 1, and polar point 2.
然后给它们赋值半径和角度,然后我可以进行刚才的操作,也就是说,对刚才的笛卡尔坐标进行的操作,让我们来运行下它吧,运行下,现在我有一个极坐标点。
If I now say, I'm going to go ahead and change the radius of this, something, my polar form did it right, but what happened to the Cartesian form?
如果我现在说,我要去改变这里的半径,一些这样的操作,我的极坐标形式,进行了正确的改动?
That's all I have to do and I have locked in the interest rate.
以上是我为了确定利率而进行的操作
I hope you can see this because I'm going to try and simulate what a merge sort does. I've got eight things I want to sort here, and those initially start out here at top level.
我希望你们认真看,因为我要尝试着模拟出归并排序的操作过程,这里我有八个元素进行排序,第一步是将它们分成两半,对吗?
Notice what this does. Certainly the heart of it, right in here, is still the same thing.
注释代码进行的操作,当然代码的核心,也就是这里。
We have some set of things we want to do with strings, and different set of things we want to do with numbers.
这就对了,我们有一个可以对字符串,进行操作的方法集,还有另外一个不同的。
Nonetheless, having done that, let's look at what I'm going to do. I now want to run a loop where I need to collect things together.
尽管如此,讲完了这些,让我们去看看,我将要进行的操作,我想要运行一个,需要把东西收集起来的循环,我要命名它。
So the interpreter is simply operating directly on your code at run time.
因此解释器在运行程序的时候,会直接的对你的代码进行操作。
Where a step is a comparison or an arithmetic operation.
第一步肯定是比较,或者进行某种算法的操作。
But underlying Python is the same idea.
对数字进行操作的方法集。
But that little short hand there is doing exactly the same thing. It is adding that value into some digits and putting it back or signing it back into some digits. And I'll walk through that loop and when I'm done I can print out the total thing does. And if I do that, I get out what I would expect.
加上得到的这个数的,但是这个缩写声明其实是进行了同样的操作,它把我们得到的这个数加到一个数上面去,然后用和对这个数进行了重新赋值,在循环中会去遍历字符串,当完成循环后,程序会显示数字的总和,如果我运行,这个程序的话,我会得到我期待的结果。
Print, assignment, certainly two obvious statements, they're commands to do something.
如Print,赋值,当然很明显的是两个声明了,他们是用来进行操作的一些命令。
Notice that that typically also defines for me what the internal variables are, what the internal characteristics of the class are going to be.
就放进去是比较好的,我写下了init声明意思就是,当你创建一个实例的时候,这就是你要进行的操作。
Because the IFs are saying, if it's true do this, otherwise skip on it.
因为IF是这样的,如果结果是真的,进行如下操作,如果不是那么跳过它吧。
I can write it explicitly. I can write it inside of a FOR loop. And we've started to add, and we'll see a lot more of this, examples of collections of structures so that we don't just have to do something that can be easily described as walking through a set of things but can actually be a collection that you walk through.
我可以明确的写出来,我可以把它在FOR循环的内部写出来,然后我们开始学习了add这个运算符,我们会在以后学习很多的,集合的数据结构的例子,这样一来我们可以进行一些,很简单的遍历集合的操作,我想要为大家指出的最后一件事情是。
应用推荐