Fluent Python: @property
摘要:
Fluent Python 9.6节讲到hashable Class, 为了使Vector2d类可散列,有以下条件: (1)实现__hash__方法 (2)实现__eq__方法 (3)让Vector2d向量不可变 如何让Vector2d类实例的向量只读呢?可以使用property,如下所示: 现在我 阅读全文
posted @ 2017-09-26 14:07 _Joshua 阅读(306) 评论(0) 推荐(0)
浙公网安备 33010602011771号