以下dataclass:from abc import ABCfrom collections.abc import Mappingfrom dataclasses import dataclass, field@dataclass(eq=True, order=True, frozen=True)class Expression(Node, ABC): def node(self): raise NotImplementedError用作基类:@dataclass(eq=True, frozen=True)class HashLiteral(Expression): pairs: Mapping[Expression, Expression] ...Node定义为:@dataclass(eq=True, frozen=True)class Node: def __str__(self) -> str: raise NotImplementedError尝试使用HashLiteral该类时出现错误:pairs: Mapping[Expression, Expression]TypeError: 'ABCMeta' object is not subscriptable我上面的注释有什么问题pairs?
添加回答
举报
0/150
提交
取消