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

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

    2. <small id='5AYRj'></small><noframes id='5AYRj'>

        <tfoot id='5AYRj'></tfoot>

        Python:NameError:未定義全局名稱“foobar"

        Python: NameError: global name #39;foobar#39; is not defined(Python:NameError:未定義全局名稱“foobar)

          <bdo id='eQJdE'></bdo><ul id='eQJdE'></ul>
            <tbody id='eQJdE'></tbody>

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

          <tfoot id='eQJdE'></tfoot>

            <i id='eQJdE'><tr id='eQJdE'><dt id='eQJdE'><q id='eQJdE'><span id='eQJdE'><b id='eQJdE'><form id='eQJdE'><ins id='eQJdE'></ins><ul id='eQJdE'></ul><sub id='eQJdE'></sub></form><legend id='eQJdE'></legend><bdo id='eQJdE'><pre id='eQJdE'><center id='eQJdE'></center></pre></bdo></b><th id='eQJdE'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='eQJdE'><tfoot id='eQJdE'></tfoot><dl id='eQJdE'><fieldset id='eQJdE'></fieldset></dl></div>
              1. <legend id='eQJdE'><style id='eQJdE'><dir id='eQJdE'><q id='eQJdE'></q></dir></style></legend>
                • 本文介紹了Python:NameError:未定義全局名稱“foobar"的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我寫了以下課程:

                  class myClass(object):
                      def __init__(self):
                          pass
                  
                      def foo(self, arg1, arg2):
                          pp = foobar(self, arg1, arg2)
                          if pp:
                              return 42
                          else
                              return -666
                  
                  
                      def foobar(self, arg1, arg2):
                          if arg1 == arg2:
                              return 42
                          else:
                              return None
                  

                  邏輯是荒謬的 - 忽略它.我試圖這樣做是從另一個實例方法調用一個實例方法 - 我得到一個 NameError.我最初認為這是由于 foo() 在定義之前調用了 foobar() - 但是在腳本中切換函數定義的順序沒有任何區別.

                  The logic is nonsensical - ignore it. What I am trying to so is to call an instance method from another instance method - and I am getting a NameError. I originally thought that this was due to foo() calling foobar() before it had been defined - but switching the order of the function definitions in the script made no difference.

                  有沒有人知道是什么導致了這個錯誤,以及如何解決它?

                  Does anyone what's causing this error, and how to fix it?

                  推薦答案

                  Python 不會自動將代碼范圍限定為本地類;你需要告訴它.

                  Python doesn't scope code to the local class automatically; you need to tell it to.

                  pp = self.foobar(arg1, arg2)
                  

                  http://docs.python.org/tutorial/classes.html

                  這篇關于Python:NameError:未定義全局名稱“foobar"的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個模塊和類)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復導入頂級名稱的情況下構造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(分發帶有已編譯動態共享庫的 Python 包)
                    <tbody id='om4pp'></tbody>
                • <tfoot id='om4pp'></tfoot>
                • <small id='om4pp'></small><noframes id='om4pp'>

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

                          <legend id='om4pp'><style id='om4pp'><dir id='om4pp'><q id='om4pp'></q></dir></style></legend>

                          • <bdo id='om4pp'></bdo><ul id='om4pp'></ul>
                          • 主站蜘蛛池模板: 拍真实国产伦偷精品 | 日韩欧美中文 | 亚洲一区二区三区观看 | 人成久久 | 欧美日韩在线免费观看 | 国产 欧美 日韩 一区 | 三级成人在线观看 | 欧美亚洲综合久久 | 射欧美 | 青青草网站在线观看 | 日韩精品一区二区三区在线播放 | 国产乱人伦精品一区二区 | 国产精品美女久久久久久免费 | 日日淫| 黄色视频a级毛片 | 国产精品1区2区3区 欧美 中文字幕 | 国产精品久久久久久一区二区三区 | a在线视频 | 中文字幕日韩欧美 | 午夜影视大全 | 国产福利视频 | 天天射视频 | 视频在线一区 | 婷婷久久网 | 日韩精品一区二区三区在线播放 | 国产精品美女www爽爽爽 | 天天草天天射 | 精品亚洲一区二区三区四区五区高 | 久草视频网站 | 精品美女视频在线观看免费软件 | 国内精品久久久久 | 国产美女自拍视频 | 黑人巨大精品欧美一区二区免费 | 久久综合一区二区 | 欧美不卡视频一区发布 | 日韩国产在线 | 99国产在线 | 国产精品综合一区二区 | av香港经典三级级 在线 | 中文字幕日韩欧美 | 国产在线看片 |