python - 石墨烯:抽象对象类型和接口之间的区别
问题描述
我无法区分graphene.Interface
对象和graphene.ObjectType
具有abstract = True
元类选项的对象。
例如:
import graphene
class A(graphene.Interface):
field_y = graphene.Int()
field_z = graphene.String()
class B(graphene.ObjectType):
class Meta:
abstract = True
field_y = graphene.Int()
field_z = graphene.String()
class ChildA(graphene.ObjectType):
class Meta:
interfaces = (A,)
field_x = graphene.Float()
class ChildB(B):
field_x = graphene.Float()
我什么时候会使用一个孩子而不是另一个?我什么时候不使用其中一个?
任何帮助表示赞赏。
解决方案
推荐阅读
- typescript - 如何使用单信号休息 api 从我的离子应用程序触发单信号通知。我已经通过了文档,但没有得到它
- python - 如何将 + 替换为 . (句号)使用python替换
- javascript - 如果用户点击第二个下拉链接,则关闭下拉菜单
- ruby - 为什么 ruby eval() 不适用于迭代值?
- amazon-web-services - 为什么 sam 包将工件发布到存储桶?
- angular - 以具有输入和复选框字段的角度拖放表格列
- python-3.x - TypeError:“类型”对象在聚类期间不可下标
- machine-learning - 为什么我们在添加多个神经网络输出时采用相同维度的层?
- c# - 尝试在 localhost 上运行 asp.net core 应用程序时出现错误 404
- php - 发布具有相同名称的多维输入数据