久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='JqR1Y'><tr id='JqR1Y'><dt id='JqR1Y'><q id='JqR1Y'><span id='JqR1Y'><b id='JqR1Y'><form id='JqR1Y'><ins id='JqR1Y'></ins><ul id='JqR1Y'></ul><sub id='JqR1Y'></sub></form><legend id='JqR1Y'></legend><bdo id='JqR1Y'><pre id='JqR1Y'><center id='JqR1Y'></center></pre></bdo></b><th id='JqR1Y'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='JqR1Y'><tfoot id='JqR1Y'></tfoot><dl id='JqR1Y'><fieldset id='JqR1Y'></fieldset></dl></div>

  • <legend id='JqR1Y'><style id='JqR1Y'><dir id='JqR1Y'><q id='JqR1Y'></q></dir></style></legend>

      <small id='JqR1Y'></small><noframes id='JqR1Y'>

      1. <tfoot id='JqR1Y'></tfoot>
          <bdo id='JqR1Y'></bdo><ul id='JqR1Y'></ul>

        多重繼承元類沖突

        Multiple inheritance metaclass conflict(多重繼承元類沖突)
        • <tfoot id='yZHgu'></tfoot>

              <i id='yZHgu'><tr id='yZHgu'><dt id='yZHgu'><q id='yZHgu'><span id='yZHgu'><b id='yZHgu'><form id='yZHgu'><ins id='yZHgu'></ins><ul id='yZHgu'></ul><sub id='yZHgu'></sub></form><legend id='yZHgu'></legend><bdo id='yZHgu'><pre id='yZHgu'><center id='yZHgu'></center></pre></bdo></b><th id='yZHgu'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='yZHgu'><tfoot id='yZHgu'></tfoot><dl id='yZHgu'><fieldset id='yZHgu'></fieldset></dl></div>
              <legend id='yZHgu'><style id='yZHgu'><dir id='yZHgu'><q id='yZHgu'></q></dir></style></legend>

                <bdo id='yZHgu'></bdo><ul id='yZHgu'></ul>

                <small id='yZHgu'></small><noframes id='yZHgu'>

                    <tbody id='yZHgu'></tbody>

                  本文介紹了多重繼承元類沖突的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我需要一個類的雙重繼承.我嘗試了幾種語法,但我不明白元類的概念.

                  I need a double inheritance for a class. I tried several syntaxes but I don't understand the concept of metaclass.

                  from PyQt5.QtGui import QStandardItem
                  from configparser import ConfigParser
                  
                  class FinalClass(ConfigParser, QStandardItem):
                      def __init__(self, param):
                          ConfigParser.__init__(self)
                          QStandardItem.__init__(self)
                  

                  推薦答案

                  你的問題是你嘗試?yán)^承的類有不同的元類:

                  The problem in your case is that the classes you try to inherit from have different metaclasses:

                  >>> type(QStandardItem)
                  <class 'sip.wrappertype'> 
                  >>> type(ConfigParser)
                  <class 'abc.ABCMeta'>
                  

                  因此,python 無法決定哪個應(yīng)該是新創(chuàng)建的類的元類.在這種情況下,它必須是繼承自 sip.wrappertype(或舊 PyQt5 版本的 PyQt5.QtCore.pyqtWrapperType)和 ABCMeta 的類代碼>.

                  Therefore python can't decide which should be the metaclass for the newly created class. In this case, it would have to be a class inheriting from both sip.wrappertype (or PyQt5.QtCore.pyqtWrapperType for older PyQt5 versions) and ABCMeta.

                  因此,元類沖突可以通過顯式引入這樣的元類來解決:

                  Therefore the metaclass conflict could be resolved by explicitly introducing such a class as metaclass like this:

                  from PyQt5.QtGui import QStandardItem
                  from configparser import ConfigParser
                  
                  class FinalMeta(type(QStandardItem), type(ConfigParser)):
                      pass
                  
                  class FinalClass(ConfigParser, QStandardItem, metaclass=FinalMeta):
                      def __init__(self, param):
                          ConfigParser.__init__(self)
                          QStandardItem.__init__(self)
                  

                  如果您想要更詳細(xì)的描述,這篇文章是一個好的開始.

                  If you want a more detailed description, this article is a good start.

                  但是我不太相信在這種情況下使用多重繼承是一個好主意,特別是與 QObjects 一起使用多重繼承可能會很棘手.也許將 ConfigParser 對象存儲為實例變量并在需要時使用它會更好.

                  However I'm not really convinced that using multiple inheritance for this situaction is such a good idea, specially using multiple inheritance together with QObjects can be tricky. Maybe it would be better to just store the ConfigParser object as an instance variable and use that when needed.

                  這篇關(guān)于多重繼承元類沖突的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數(shù)綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標(biāo)簽設(shè)置在固定位置,以便當(dāng)我向左或向右滾動時,yaxis 刻度標(biāo)簽應(yīng)該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構(gòu)造函數(shù)有未知關(guān)鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)

                  <small id='KNiF1'></small><noframes id='KNiF1'>

                      1. <i id='KNiF1'><tr id='KNiF1'><dt id='KNiF1'><q id='KNiF1'><span id='KNiF1'><b id='KNiF1'><form id='KNiF1'><ins id='KNiF1'></ins><ul id='KNiF1'></ul><sub id='KNiF1'></sub></form><legend id='KNiF1'></legend><bdo id='KNiF1'><pre id='KNiF1'><center id='KNiF1'></center></pre></bdo></b><th id='KNiF1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='KNiF1'><tfoot id='KNiF1'></tfoot><dl id='KNiF1'><fieldset id='KNiF1'></fieldset></dl></div>
                          <tfoot id='KNiF1'></tfoot>
                            <tbody id='KNiF1'></tbody>
                          <legend id='KNiF1'><style id='KNiF1'><dir id='KNiF1'><q id='KNiF1'></q></dir></style></legend>
                            <bdo id='KNiF1'></bdo><ul id='KNiF1'></ul>
                          • 主站蜘蛛池模板: 亚洲国产情侣自拍 | 草久久久 | 欧美亚洲视频在线观看 | 国产免费一区二区 | 狠狠插天天干 | 国产欧美一区二区三区日本久久久 | 欧美xxxx做受欧美 | 黑人巨大精品欧美一区二区免费 | 午夜精品 | 国产精品久久av | 做a视频 | 日韩免费一区二区 | 国产精品国产三级国产aⅴ中文 | 久久精品国产免费看久久精品 | 91精品久久久久久久久中文字幕 | 国产精品久久久久久238 | 成年精品 | 91av视频| 国产激情综合五月久久 | 不卡一二三区 | 福利一区在线观看 | 人人看人人爽 | 两性午夜视频 | 久久大陆 | 激情国产在线 | 成人国产精品久久久 | 成人在线一区二区三区 | 久久精品视频网站 | 黄色综合 | 一区二区三区视频在线观看 | 精品久久久久香蕉网 | 午夜精品一区二区三区在线观看 | 欧美成人综合 | 亚洲激情一区二区三区 | 国产综合精品一区二区三区 | 国产精品91网站 | 国产精品一区二区三区久久 | 日韩一区二区黄色片 | 亚洲欧美日韩精品久久亚洲区 | 看a网站| 欧美一区二区在线观看 |