如果编程语言支持运算符重载,则还应提供等号和不等号运算符的实现。
If your programming language supports operator overloading, you should also provide an implementation of the equality and inequality operators.
目标在于避免意外地使用单等号赋值运算符而非双等号比较运算符
The goal here is to avoid accidentally using the single-equals assignment operator instead of the double-equals comparison operator
和字符串不同的是,列表是可以修改的。方括号运算符放到一个赋值语句的等号左侧的时候,就会把对应位置的列表元素重新赋值。
Unlike strings, lists are mutable. When the bracket operator appears on the left side of an assignment, it identifies the element of the list that will be assigned.
和字符串不同的是,列表是可以修改的。方括号运算符放到一个赋值语句的等号左侧的时候,就会把对应位置的列表元素重新赋值。
Unlike strings, lists are mutable. When the bracket operator appears on the left side of an assignment, it identifies the element of the list that will be assigned.
应用推荐