【发布时间】:2016-01-15 04:28:11
【问题描述】:
我正在尝试学习 Python 3。在我读的一本书中,定义一个你使用的类:
class Classname:
# and so on
在另一个上面写着:
class Classname(object):
# and so on
哪种方法是正确的?它们有何不同?
【问题讨论】:
标签: python class python-3.x
我正在尝试学习 Python 3。在我读的一本书中,定义一个你使用的类:
class Classname:
# and so on
在另一个上面写着:
class Classname(object):
# and so on
哪种方法是正确的?它们有何不同?
【问题讨论】:
标签: python class python-3.x
只有 python 2.7 有区别:old-style and new-style classes in Python 2.7?
在python 3中
class SomeClass:
...
和
一样class SomeClass(object):
...
【讨论】: