<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ### 導航 - [索引](../genindex.xhtml "總目錄") - [模塊](../py-modindex.xhtml "Python 模塊索引") | - [下一頁](gc.xhtml "gc --- 垃圾回收器接口") | - [上一頁](traceback.xhtml "traceback --- Print or retrieve a stack traceback") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) ? - zh\_CN 3.7.3 [文檔](../index.xhtml) ? - [Python 標準庫](index.xhtml) ? - [Python運行時服務](python.xhtml) ? - $('.inline-search').show(0); | # [`__future__`](#module-__future__ "__future__: Future statement definitions") --- Future 語句定義 **源代碼:** [Lib/\_\_future\_\_.py](https://github.com/python/cpython/tree/3.7/Lib/__future__.py) \[https://github.com/python/cpython/tree/3.7/Lib/\_\_future\_\_.py\] - - - - - - [`__future__`](#module-__future__ "__future__: Future statement definitions") 是一個真正的模塊,這主要有 3 個原因: - 避免混淆已有的分析 import 語句并查找 import 的模塊的工具。 - 確保 [future 語句](../reference/simple_stmts.xhtml#future) 在 2.1 之前的版本運行時至少能拋出 runtime 異常(import [`__future__`](#module-__future__ "__future__: Future statement definitions") 會失敗,因為 2.1 版本之前沒有這個模塊)。 - 當引入不兼容的修改時,可以記錄其引入的時間以及強制使用的時間。這是一種可執行的文檔,并且可以通過 import [`__future__`](#module-__future__ "__future__: Future statement definitions") 來做程序性的檢查。 `__future__.py` 中的每一條語句都是以下格式的: ``` FeatureName = _Feature(OptionalRelease, MandatoryRelease, CompilerFlag) ``` 通常 *OptionalRelease* 要比 *MandatoryRelease* 小,并且都是和 [`sys.version_info`](sys.xhtml#sys.version_info "sys.version_info") 格式一致的 5 元素元組。 ``` (PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int PY_MINOR_VERSION, # the 1; an int PY_MICRO_VERSION, # the 0; an int PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string PY_RELEASE_SERIAL # the 3; an int ) ``` *OptionalRelease* 記錄了一個特性首次發布時的 Python 版本。 在 *MandatoryRelases* 還沒有發布時,*MandatoryRelease* 表示該特性會變成語言的一部分的預測時間。 其他情況下,*MandatoryRelease* 用來記錄這個特性是何時成為語言的一部分的。從該版本往后,使用該特性將不需要 future 語句,不過很多人還是會加上對應的 import。 *MandatoryRelease* 也可能是 `None`, 表示這個特性已經被撤銷。 `_Feature` 類的實例有兩個對應的方法,`getOptionalRelease()` 和 `getMandatoryRelease()`。 *CompilerFlag* 是一個(位)標記,對于動態編譯的代碼,需要將這個標記作為第四個參數傳入內建函數 [`compile()`](functions.xhtml#compile "compile") 中以開啟對應的特性。這個標記存儲在 `_Feature` 類實例的 `compiler_flag` 屬性中。 [`__future__`](#module-__future__ "__future__: Future statement definitions") 中不會刪除特性的描述。從 Python 2.1 中首次加入以來,通過這種方式引入了以下特性: 特性 可選版本 強制加入版本 效果 nested\_scopes 2\.1.0b1 2\.2 [**PEP 227**](https://www.python.org/dev/peps/pep-0227) \[https://www.python.org/dev/peps/pep-0227\]: *Statically Nested Scopes* generators 2\.2.0a1 2\.3 [**PEP 255**](https://www.python.org/dev/peps/pep-0255) \[https://www.python.org/dev/peps/pep-0255\]: *Simple Generators* division 2\.2.0a2 3\.0 [**PEP 238**](https://www.python.org/dev/peps/pep-0238) \[https://www.python.org/dev/peps/pep-0238\]: *Changing the Division Operator* absolute\_import 2\.5.0a1 3\.0 [**PEP 328**](https://www.python.org/dev/peps/pep-0328) \[https://www.python.org/dev/peps/pep-0328\]: *Imports: Multi-Line and Absolute/Relative* with\_statement 2\.5.0a1 2\.6 [**PEP 343**](https://www.python.org/dev/peps/pep-0343) \[https://www.python.org/dev/peps/pep-0343\]: *The "with" Statement* print\_function 2\.6.0a2 3\.0 [**PEP 3105**](https://www.python.org/dev/peps/pep-3105) \[https://www.python.org/dev/peps/pep-3105\]: *Make print a function* unicode\_literals 2\.6.0a2 3\.0 [**PEP 3112**](https://www.python.org/dev/peps/pep-3112) \[https://www.python.org/dev/peps/pep-3112\]: *Bytes literals in Python 3000* generator\_stop 3\.5.0b1 3\.7 [**PEP 479**](https://www.python.org/dev/peps/pep-0479) \[https://www.python.org/dev/peps/pep-0479\]: *StopIteration handling inside generators* annotations 3\.7.0b1 4\.0 [**PEP 563**](https://www.python.org/dev/peps/pep-0563) \[https://www.python.org/dev/peps/pep-0563\]: *Postponed evaluation of annotations* 參見 [future 語句](../reference/simple_stmts.xhtml#future)編譯器怎樣處理 future import。 ### 導航 - [索引](../genindex.xhtml "總目錄") - [模塊](../py-modindex.xhtml "Python 模塊索引") | - [下一頁](gc.xhtml "gc --- 垃圾回收器接口") | - [上一頁](traceback.xhtml "traceback --- Print or retrieve a stack traceback") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) ? - zh\_CN 3.7.3 [文檔](../index.xhtml) ? - [Python 標準庫](index.xhtml) ? - [Python運行時服務](python.xhtml) ? - $('.inline-search').show(0); | ? [版權所有](../copyright.xhtml) 2001-2019, Python Software Foundation. Python 軟件基金會是一個非盈利組織。 [請捐助。](https://www.python.org/psf/donations/) 最后更新于 5月 21, 2019. [發現了問題](../bugs.xhtml)? 使用[Sphinx](http://sphinx.pocoo.org/)1.8.4 創建。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看