【发布时间】:2014-01-14 16:40:23
【问题描述】:
正如Is it necessary or useful to inherit from python's object in Python 3.x? 和Python class inherits object 明确指出的那样,在Python 3 中定义类时,不再需要从object 继承。
作为一个推论,这两个问题都没有直接解决:在编写新的 Python 3 代码时,我是否应该更喜欢其中一种风格?为了更清晰的类定义而放弃object 基类,还是保留它以便(可能)使未来的Python 2 移植更容易?
【问题讨论】:
标签: python class python-3.x coding-style new-style-class