我已经在VS代码上写了thad代码
from datetime import date
Title = 'Actividad #$'
Complexity = 0
Time = 5 #cantidad en dias
class Activitie(Title,Complexity,Time):
"""Log your activity with this class"""
Title = 'Actividad #$'
Complexity = 0
Time = 5 #cantidad en dias
它显示
Inheriting 'Time', which is not a class.
Inheriting 'Complexity', which is not a class.
Inheriting 'Title', which is not a class.
和...
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
感谢您提供任何解决方案
请原谅我的英语:V
看起来您想定义类对象构造函数,但是您偶然使用Python的类继承语法来完成它。
这里是定义类及其对象构造函数的方法:
class Activitie:
def __init__(self, Title, Complexity, Time):
"""Log your activity with this class"""
self.Title = Title
self.Complexity = Complexity
self.Time = Time
您收到此继承错误,是因为在Python中声明继承的语法如下:
SubClass(ParentClassA, ParentClassB, ParentClassC):