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

  • <small id='QrzmM'></small><noframes id='QrzmM'>

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

      • <bdo id='QrzmM'></bdo><ul id='QrzmM'></ul>

      <tfoot id='QrzmM'></tfoot>

        inspect.getmembers() vs __dict__.items() vs dir()

        inspect.getmembers() vs __dict__.items() vs dir()(inspect.getmembers() vs __dict__.items() vs dir())
            • <legend id='4avDm'><style id='4avDm'><dir id='4avDm'><q id='4avDm'></q></dir></style></legend>

                <small id='4avDm'></small><noframes id='4avDm'>

                  <tbody id='4avDm'></tbody>
              1. <tfoot id='4avDm'></tfoot>

                  <bdo id='4avDm'></bdo><ul id='4avDm'></ul>

                  <i id='4avDm'><tr id='4avDm'><dt id='4avDm'><q id='4avDm'><span id='4avDm'><b id='4avDm'><form id='4avDm'><ins id='4avDm'></ins><ul id='4avDm'></ul><sub id='4avDm'></sub></form><legend id='4avDm'></legend><bdo id='4avDm'><pre id='4avDm'><center id='4avDm'></center></pre></bdo></b><th id='4avDm'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='4avDm'><tfoot id='4avDm'></tfoot><dl id='4avDm'><fieldset id='4avDm'></fieldset></dl></div>
                  本文介紹了inspect.getmembers() vs __dict__.items() vs dir()的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  誰能用足夠的例子向我解釋一下b/w有什么區(qū)別

                  Can anybody explain to me with adequate examples whats the difference b/w

                  >>> import inspect
                  >>> inspect.getmembers(1)
                  

                  >>> type(1).__dict__.items()
                  

                  >>> dir(1)  
                  

                  除了它們顯示出減少的屬性數(shù)量和按順序排列的方法.1 是整數(shù)(但它可以是任何類型.)

                  except that they show an decreasing no.s of attributes & methods in that order. 1 is integer (but it can be of any type.)

                  編輯

                  >>>obj.__class__.__name__  #gives the class name of object  
                  >>>dir(obj)                #gives attributes & methods  
                  >>>dir()                   #gives current scope/namespace
                  >>>obj.__dict__            #gives attributes
                  

                  推薦答案

                  dir() 允許您通過定義 __dir__() 自定義對(duì)象報(bào)告的屬性.

                  dir() allows you to customize what attributes your object reports, by defining __dir__().

                  從手冊(cè)中,如果 __dir__() 沒有定義:

                  From the manual, if __dir__() is not defined:

                  如果對(duì)象是模塊對(duì)象,則列表包含模塊屬性的名稱.

                  If the object is a module object, the list contains the names of the module’s attributes.

                  如果對(duì)象是類型或類對(duì)象,則列表包含其屬性的名稱,并遞歸地包含其基類的屬性.

                  If the object is a type or class object, the list contains the names of its attributes, and recursively of the attributes of its bases.

                  否則,列表包含對(duì)象的屬性名稱、其類屬性的名稱,以及其類的基類屬性的遞歸名稱.

                  Otherwise, the list contains the object’s attributes’ names, the names of its class’s attributes, and recursively of the attributes of its class’s base classes.

                  這也是 inspect.getmembers() 返回的內(nèi)容,只不過它返回的是 (name, attribute) 的元組,而不僅僅是名稱.

                  This is also what inspect.getmembers() returns, except it returns tuples of (name, attribute) instead of just the names.

                  object.__dict__{key: attribute, key2: atrribute2} 等形式的字典.

                  object.__dict__ is a dictionary of the form {key: attribute, key2: atrribute2} etc.

                  object.__dict__.keys() 有其他兩個(gè)所缺少的.

                  object.__dict__.keys() has what the other two are lacking.

                  來自 inspect.getmembers() 上的文檔:

                  當(dāng)參數(shù)是一個(gè)類時(shí),getmembers() 不返回元類屬性(此行為繼承自 dir() 函數(shù)).

                  getmembers() does not return metaclass attributes when the argument is a class (this behavior is inherited from the dir() function).

                  對(duì)于 int.__dict__.keys(),這是

                  ['__setattr__', '__reduce_ex__', '__reduce__', '__class__', '__delattr__', '__subclasshook__', '__sizeof__', '__init__']
                  

                  總結(jié)一下,dir()inspect.getmembers()基本相同,而__dict__是包含元類屬性的完整命名空間.

                  To summarize, dir() and inspect.getmembers() are basically the same, while __dict__ is the complete namespace including metaclass attributes.

                  這篇關(guān)于inspect.getmembers() vs __dict__.items() vs dir()的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個(gè)模塊和類)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點(diǎn)包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復(fù)導(dǎo)入頂級(jí)名稱的情況下構(gòu)造python包)
                  Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                  How to refresh sys.path?(如何刷新 sys.path?)
                  Distribute a Python package with a compiled dynamic shared library(分發(fā)帶有已編譯動(dòng)態(tài)共享庫(kù)的 Python 包)
                      <tbody id='b6Bz8'></tbody>
                    <legend id='b6Bz8'><style id='b6Bz8'><dir id='b6Bz8'><q id='b6Bz8'></q></dir></style></legend>

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

                          <tfoot id='b6Bz8'></tfoot>

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

                          1. 主站蜘蛛池模板: 午夜精品久久久 | 国产盗摄视频 | 久久看精品 | 丝袜美腿一区二区三区 | 天天综合久久 | 国产精品伦理一区二区三区 | 久久国产视频网站 | 成人午夜电影网 | 亚洲精品一区中文字幕乱码 | a级在线免费 | 自拍视频网 | 91精品国产91久久久 | 国产婷婷色综合av蜜臀av | 成人一区二区视频 | 国产一区二区三区色淫影院 | 久草久草久草 | 欧美国产日韩一区 | 午夜天堂精品久久久久 | 欧美a级网站| 99视频在线播放 | 国产精品久久久久久久久图文区 | 91xxx在线观看 | 午夜精品一区二区三区在线播放 | 国产成都精品91一区二区三 | 日本一区二区三区免费观看 | 九九久久久 | 91av视频在线观看 | 久久9精品 | 一区二区三区视频在线免费观看 | 99久9| 久久久国产一区二区三区四区小说 | 日韩免费中文字幕 | 亚洲精品视频播放 | a级毛片免费高清视频 | 网站黄色在线 | 夜夜摸夜夜操 | 红色av社区 | 亚洲一区二区三区在线播放 | 日本成人免费网站 | 久久亚洲精品久久国产一区二区 | 久草成人|