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

    • <bdo id='bElHS'></bdo><ul id='bElHS'></ul>
    <tfoot id='bElHS'></tfoot>

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

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

      2. 什么是 Python 命名空間

        What are Python namespaces all about(什么是 Python 命名空間)
        • <legend id='3T1ME'><style id='3T1ME'><dir id='3T1ME'><q id='3T1ME'></q></dir></style></legend>
            <tbody id='3T1ME'></tbody>
          <tfoot id='3T1ME'></tfoot>

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

            <small id='3T1ME'></small><noframes id='3T1ME'>

                <bdo id='3T1ME'></bdo><ul id='3T1ME'></ul>
                  本文介紹了什么是 Python 命名空間的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我剛剛開始學(xué)習(xí) Python &在 Python 中遇到過 "namespaces" 概念.雖然我知道它是什么,但我無法理解這個(gè)概念的嚴(yán)重性.

                  I have just started learning Python & have come across "namespaces" concept in Python. While I got the jist of what it is, but am unable to appreciate the gravity of this concept.

                  網(wǎng)上的一些瀏覽顯示,反對(duì) PHP 的原因之一是它不支持命名空間.

                  Some browsing on the net revealed that one of the reasons going against PHP is that it has no native support for namespaces.

                  有人能解釋一下如何使用命名空間嗎?此功能如何使編程變得更好(不僅僅是在 Python 中,因?yàn)槲壹僭O(shè)命名空間不是僅限于特定語言的概念).

                  Could someone explain how to use namespaces & how this feature makes programming better (not just in Python, as I assume namespaces in not a concept limited to a particular language).

                  我主要來自 Java 和 C 編程背景.

                  I am predominantly coming from Java and C programming backgrounds.

                  推薦答案

                  命名空間是實(shí)現(xiàn)作用域的一種方式.

                  Namespace is a way to implement scope.

                  在 Java(或 C)中,編譯器通過靜態(tài)范圍分析確定變量在何處可見.

                  In Java (or C) the compiler determines where a variable is visible through static scope analysis.

                  • 在 C 中,作用域要么是函數(shù)體,要么是全局的,要么是外部的.編譯器會(huì)為您解釋這一點(diǎn),并根據(jù)范圍規(guī)則解析每個(gè)變量名稱.編譯所有模塊后,外部名稱由鏈接器解析.

                  • In C, scope is either the body of a function or it's global or it's external. The compiler reasons this out for you and resolves each variable name based on scope rules. External names are resolved by the linker after all the modules are compiled.

                  在 Java 中,作用域是方法函數(shù)的主體,或類的所有方法.一些類名也具有模塊級(jí)范圍.同樣,編譯器會(huì)在編譯時(shí)計(jì)算出這一點(diǎn),并根據(jù)作用域規(guī)則解析每個(gè)名稱.

                  In Java, scope is the body of a method function, or all the methods of a class. Some class names have a module-level scope, also. Again, the compiler figures this out at compile time and resolves each name based on the scope rules.

                  在 Python 中,每個(gè)包、模塊、類、函數(shù)和方法函數(shù)都擁有一個(gè)命名空間",在其中解析變量名.另外,如果名稱不在本地命名空間中,則使用全局命名空間.

                  In Python, each package, module, class, function and method function owns a "namespace" in which variable names are resolved. Plus there's a global namespace that's used if the name isn't in the local namespace.

                  每個(gè)變量名在本地命名空間(函數(shù)體、模塊等)中檢查,然后在全局命名空間中檢查.

                  Each variable name is checked in the local namespace (the body of the function, the module, etc.), and then checked in the global namespace.

                  變量通常只在本地命名空間中創(chuàng)建.globalnonlocal 語句可以在本地命名空間之外創(chuàng)建變量.

                  Variables are generally created only in a local namespace. The global and nonlocal statements can create variables in other than the local namespace.

                  當(dāng)一個(gè)函數(shù)、方法函數(shù)、模塊或包被評(píng)估(即開始執(zhí)行)時(shí),一個(gè)命名空間被創(chuàng)建.將其視為評(píng)估上下文".當(dāng)一個(gè)函數(shù)或方法函數(shù)等完成執(zhí)行時(shí),命名空間被刪除.變量被刪除.對(duì)象也可能被丟棄.

                  When a function, method function, module or package is evaluated (that is, starts execution) a namespace is created. Think of it as an "evaluation context". When a function or method function, etc., finishes execution, the namespace is dropped. The variables are dropped. The objects may be dropped, also.

                  這篇關(guān)于什么是 Python 命名空間的文章就介紹到這了,希望我們推薦的答案對(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)共享庫的 Python 包)
                    <legend id='xXPlZ'><style id='xXPlZ'><dir id='xXPlZ'><q id='xXPlZ'></q></dir></style></legend>
                      <tbody id='xXPlZ'></tbody>

                  • <tfoot id='xXPlZ'></tfoot>
                        <bdo id='xXPlZ'></bdo><ul id='xXPlZ'></ul>
                        1. <small id='xXPlZ'></small><noframes id='xXPlZ'>

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

                          1. 主站蜘蛛池模板: 日本一二三区高清 | 麻豆精品一区二区三区在线观看 | 国产精品美女久久久久久免费 | 一区二区三区欧美在线观看 | 毛片在线免费播放 | 国产成人99 | 天天天天天天操 | 羞羞视频在线观看免费观看 | 五月婷六月丁香 | 国产精品视频免费看 | 久草精品在线 | 日韩视频1| 欧美一区免费 | 成人免费视频网站在线看 | 性一交一乱一伦视频免费观看 | 亚洲精品一区二区三区在线 | 欧美 日韩 中文 | 亚洲久在线 | 在线观看中文字幕一区二区 | 狠狠综合久久av一区二区老牛 | 97视频免费| 精品久久成人 | 伊人伊人网 | 亚洲一区二区三区桃乃木香奈 | 在线看亚洲 | 亚洲成人免费电影 | 日日爽 | 在线观看中文视频 | 国产日韩精品视频 | 羞羞视频免费观看入口 | 日产精品久久久一区二区福利 | 久草久草久草 | 国产精品久久久久久亚洲调教 | 一级网站 | 亚洲视频欧美视频 | 91精品国产日韩91久久久久久 | 91.色| 国产99久久精品一区二区永久免费 | 国产在线视频一区二区董小宛性色 | 综合色导航 | 亚洲成人在线免费 |