python / python-docs-zh-cn

zh_CN translation of the Python documentation
https://docs.python.org/zh-cn/
431 stars 74 forks source link

[Typo]: 多余的未翻译文本 #336

Closed HairlessVillager closed 10 months ago

HairlessVillager commented 10 months ago

Python Version

3.12, 3.11.6, 3.10.13

Docs Page

https://docs.python.org/zh-cn/3/reference/datamodel.html

Original Translation

如果一个类没有定义 eq() 方法那么它也不应该定义 hash() 操作;如果它定义了 eq() 但没有定义 hash(),则其实例将不可被用作可哈希多项集的条目。 如果一个类定义了可变对象并实现了 eq() 方法,则它不应该实现 hash(),因为 hashable 多项集的实现要求键的哈希值是不可变的(如果对象的哈希值发生改变,它将位于错误的哈希桶中)。 hash bucket).

Original Docs Paragraph

If a class does not define an eq() method it should not define a hash() operation either; if it defines eq() but not hash(), its instances will not be usable as items in hashable collections. If a class defines mutable objects and implements an eq() method, it should not implement hash(), since the implementation of hashable collections requires that a key’s hash value is immutable (if the object’s hash value changes, it will be in the wrong hash bucket).

Suggested Fix

如果一个类没有定义 eq() 方法那么它也不应该定义 hash() 操作;如果它定义了 eq() 但没有定义 hash(),则其实例将不可被用作可哈希多项集的条目。 如果一个类定义了可变对象并实现了 eq() 方法,则它不应该实现 hash(),因为 hashable 多项集的实现要求键的哈希值是不可变的(如果对象的哈希值发生改变,它将位于错误的哈希桶中)。

WendaoLee commented 10 months ago

Fixed.