The syntax is OK in the sense of, it is an operand, an operator, an operand, so syntactically it's OK.
这里的语法应该是好的,有个运算对象,一个运算符,另外一个运算对象,因此语法上是没错的。
- And here as promised is that other operator -- looks a little weird, but because assignment is already using the equal sign to assign one value on the right to a variable on the left.
在这里正像所承诺的那样,其他的操作-,看起来有点怪异,但是因为“=“已经被用来当赋值运算符了,用来把右边的一个值赋值给左边的变量。
The semantics was what caused the problem, because the operator was expecting a particular kind of structure there.
引起问题的是语义,因为运算符需要的是,一种特定种类的数据结构。
STUDENT: What does it mean, the operator used, when you were calculating the remainder between nine and five?
学生:这是什么意思,当你用这个运算符去算,9除以5的余数的时候?
The reason I say that is, by having operator overloading I can use 1 generic interface to all of the objects that I want to use.
他在大多数情况下都是对的,我要这么说的原因是,通过运算符重载我可以,用一个通用的借口对。
So, I'm now multiplying by the result of calling the size of operator, which we've seen before.
现在我乘以运算符的大小,之前我们看到的。
STUDENT: Standard order of operations, I guess take the multiplication first, and add the three.
学生:标准运算符的顺序,我猜是先做乘法,然后再去加3。
So this is the equality operator, whereas the single equal sign is the assignment operator.
所以这是相等操作符,然而那个单等号是一个赋值运算符。
That is, if I want to combine two things together in a particular way, I need to make sure that I give it the kind of operand it expects.
也就是,如果我想以一种特定的方式,把两个东西组合到一块,我需要确定,给了运算符它想要的输入。
And again, you've got to be careful about how you use the operators.
再提醒一次,你们用运算符的时候,要多加小心。
The equal sign is really called the "assignment operator."
那个等号其实是个“赋值运算符“
So the assignment operator thus far makes copies of things.
所以到现在为止,赋值运算符复制了很多数据。
Especially in the presence of operator overload.
尤其是运算符重载,这种情况出现的时候。
So you don't have to use the assignment operator.
所以你并不需要使用赋值运算符。
One of the other things we showed last time is that operators are overloaded.
我们上次讲过的一个话题,是运算符的重载。
Now, less than is just, if you haven't used it before, it's just the operator you'd expect, it's comparing two things and it's going to return either true or false depending on whether the first argument is false less than the second argument.
现在,小于这个符号是,如果你之前没用过它的话,它就是你期望的那个运算符,它会比较两个独享,然后基于第一个参数是不是,小于第二个参数,返回true或者。
And in Python the expression is, operand, operator, operand, when we're doing simple expressions like this, and if I give it to the interpreter, it gives me back exactly what you'd expect, which is that value. OK?
在Python中表达式就是,运算对象,操作符,运算对象,当我们处理这样的简单表达式的时候,我把表达式传给处理器,处理器给我返回了我想要的结果,对不对?
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这个运算符,我们会在以后学习很多的,集合的数据结构的例子,这样一来我们可以进行一些,很简单的遍历集合的操作,我想要为大家指出的最后一件事情是。
应用推荐