Python-“对象布局” [英] Python - "object layout"
本文介绍了Python-“对象布局”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以描述以下异常吗?什么是对象布局及其定义方式?谢谢
can somebody describe the following exception? What is the "object layout" and how it is defined? Thanks
Traceback (most recent call last):
File "test_gui.py", line 5, in <module>
suite = AlgorithmEngine('gui_suite')
File "/home/honza/Research/Voiar/algorithm.py", line 169, in __init__
self.algorithms = self._initAlgorithms()
File "/home/honza/Research/Voiar/algorithm.py", line 232, in _initAlgorithms
self._initGUIAlgorithm(obj)
File "/home/honza/Research/Voiar/algorithm.py", line 218, in _initGUIAlgorithm
cls.__bases__ = bases
TypeError: __bases__ assignment: 'QWidget' object layout differs from 'GUIAlgorithm'
推荐答案
这意味着您试图更改对象的类型(通过分配给 __ bases__
),而新类型与旧类型不兼容。两种类型的基础C数据结构都不相同时,就会发生这种情况。
It means that you tried to change the type of an object (by assigning to __bases__
) and the new type wasn't compatible with the old one. This happens when the underlying C data structure isn't the same for both types.
请参见 http://www.mail-archive.com/python-list@python.org/msg52950.html 以获得差异列表可能触发此异常的类型之间。
See http://www.mail-archive.com/python-list@python.org/msg52950.html for a list of differences between types that might trigger this exception.
这篇关于Python-“对象布局”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文