继承该类的类的元类? [英] metaclass that inherits a class of that metaclass?

查看:107
本文介绍了继承该类的类的元类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望这看起来不会太混乱,但我需要创建一个

元类和一个使用该元类的类,这样的基础之一

of元类是使用该元类创建的类。即使在创建类之后尝试将类添加为

基础,我也无法获得
找到一种方法。


有什么方法可以让它正常工作吗?

Hoping this isn''t seeming too confusing, but I need to create a
metaclass and a class using that metaclass, such that one of the bases
of the metaclass is the class created with that metaclass. I can''t
figure out a way to do this, even after trying to add the class as a
base after the classes have been created.

Is there some way I can get this to work properly?

推荐答案

为什么以名义所有这些都是圣洁的,你需要这样做吗?

Why in the name of all that is holy and just would you need to do such
a thing?


因为他们代表一个单独的打字系统外面

python,我正在创建一个桥梁。元类表示此其他系统的

类型,该类表示最基本的
对象类型,但由于元类表示的类型也是

对象,这是我看到正确代表关系

的唯一方式。

because they are representing a seperate typing system outside of
python, to which I am creating a bridge. The metaclass represents the
types of this other system and the class represents the most basic
object type, but since the types the metaclass represent are also
objects, this is the only way i see to represent the relationship
properly.


我不认为这是有道理的。你怎么可能用任何语言创造这样的东西之间的循环关系?此外,如果我完全理解元类,只有其他元类可以是

元类的基础。


为什么不使用python类用

python元类表示其他系统的类型作为type类型?

I don''t think that makes any sense. How could you possibly create such
a circular relationship between things in any language? Besides, if I
understand metaclasses at all, only other metaclasses can be bases of a
metaclass.

Why not use python classes to represent the other system''s types with a
python metaclass as the "type" type?


这篇关于继承该类的类的元类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆