Skip to content

Commit 5345bd3

Browse files
author
Liu Jie
authored
Update p24_making_classes_support_comparison_operations.rst
来 -> 类
1 parent 3978bdd commit 5345bd3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

source/c08/p24_making_classes_support_comparison_operations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Python类对每个比较操作都需要实现一个特殊方法来支持。
1515
尽管定义一个方法没什么问题,但如果要你实现所有可能的比较方法那就有点烦人了。
1616

1717
装饰器 ``functools.total_ordering`` 就是用来简化这个处理的。
18-
使用它来装饰一个来,你只需定义一个 ``__eq__()`` 方法,
18+
使用它来装饰一个类,你只需定义一个 ``__eq__()`` 方法,
1919
外加其他方法(__lt__, __le__, __gt__, or __ge__)中的一个即可。
2020
然后装饰器会自动为你填充其它比较方法。
2121

0 commit comments

Comments
 (0)