久久久久久久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>

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

                  問題描述

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

                  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 無法決定哪個(gè)應(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ì)的描述,這篇文章是一個(gè)好的開始.

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

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

                  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)于多重繼承元類沖突的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(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 啟動(dòng)后進(jìn)度躍升至 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)我向左或向右滾動(dòng)時(shí),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時(shí)顯示進(jìn)度條?)

                  <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>
                          • 主站蜘蛛池模板: 一区二区久久 | 桃色五月 | 日韩精品人成在线播放 | 成人妇女免费播放久久久 | 久在线视频播放免费视频 | 久久久久久成人 | 日本在线观看网址 | 日本在线你懂的 | 欧州一区 | 欧美黄色性生活视频 | 日本特黄a级高清免费大片 国产精品久久性 | 精品国产鲁一鲁一区二区张丽 | 国产视频二区 | 91亚洲国产成人精品一区二三 | 久久乐国产精品 | 欧美精品二区 | 一区二区三区视频在线 | 蜜臀网站| 四虎影院久久 | 欧美三级成人理伦 | 久久综合狠狠综合久久综合88 | 日本成人综合 | 日韩中文字幕免费在线观看 | 久久综合激情 | 国产一区二区三区四区五区加勒比 | 日本一道本 | 欧美一级在线观看 | 国产精品亚洲成在人线 | 中国三级黄色录像 | 欧美日韩成人在线 | 夜夜夜夜夜夜曰天天天 | 欧美中文字幕一区 | 成人精品免费视频 | 欧美久久久久久久久中文字幕 | 欧美一区二区三区视频 | 91资源在线 | 在线观看国产视频 | 羞羞视频网站免费观看 | 国产综合久久 | 亚洲aⅴ | 成人免费观看视频 |