@dataclass
class base:
data_dir: Path = Path(__file__).parents[1] / 'data'
models_dir: Path = data_dir / 'models'
@dataclass
class field(base):
id: str
data_source: str # can be a csv file or a database
df: pd.DataFrame # dataframe containing field information
def get_field(self):
pass
在上面的代码中,出现此错误:
TypeError: non-default argument 'id' follows default argument
我该如何解决?