- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
运行 lint 时,出现以下错误:
Redefining name 'tmp_file' from outer scope (line 38) (redefined-outer-name)
这是我在该行中的代码片段:
tmp_file = open('../build/' + me_filename + '.js','w')
最佳答案
发生这种情况是因为您的本地名称与全局名称相同。当然,局部名称优先,但它隐藏了全局名称,使其不可访问,并给读者造成混淆。
解决方案
更改本地名称。或者可能是全局名称,无论什么更有意义。但请注意,全局名称可能是公共(public)模块接口(interface)的一部分。本地名称应该是本地名称,因此可以安全更改。
除非...您的意图是让这些名称相同。然后您需要在本地范围内将名称声明为 global
:
tmp_file = None
def do_something():
global tmp_file # <---- here!
tmp_file = open(...)
如果没有 global
声明,本地 tmp_file
将与全局文件无关。因此警告。
关于python - 我收到错误 'redefined-outer-name',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24999937/
class Outer { class Inner { } } public class Demo { public static void main(
不确定我是否明白这一点,但我从 pyLint 收到验证错误说: Redefining name 'a' from outer scope (line 443) (redefined-outer-nam
我是 SQL 新手,最近开始在我的代码中实现联接,我希望检索的数据可以使用以下 SQL 语句来完成。但是,如您所知,SQLite3 不支持 RIGHT OUTER 和 FULL OUTER JOIN。
怀疑但不确定:是 FROM 中表格的简单列表-clause 根据定义是完全连接? SELECT * FROM table1, table2 我们在参数不相等的情况下连接表的情况是否是完全外连接的实现?
我想知道 numpy 中是否有一个功能与 np.outer 类似,但使用二维数组和向量作为输入参数。结果应该是一个 3 维数组。 例如,如果我有一个矩阵 M 和一个向量 v,我想将原始矩阵 M 堆叠
以下代码在 MSVC 上编译: #include class Bob { int a; friend class Outer; }; class Outer {
Spark SQL 文档指定 join()支持以下连接类型: Must be one of: inner, cross, outer, full, full_outer, left, left_out
谁能帮我解决以下问题.. 这里我们有1.左外连接2.两个右外连接 如何结合左右 O.J 并创建与上面相同的效果, 我需要重写相同的查询,这是因为我正在将旧的 ms SQL2009 转换为 ms SQL
关闭。这个问题需要更多focused .它目前不接受答案。 想改善这个问题吗?更新问题,使其仅关注一个问题 editing this post . 4年前关闭。 Improve this questi
使用 ANSI 语法的 Informix 查询性能是否有差异: SELECT .. LEFT OUTER JOIN some_table ON () LEFT OUTER JOIN some_
根据clang , gcc 和 vs2013,函数 Outer::f 是 not 类 Outer::Inner 的 friend 。 struct Outer { void f() {}
换句话说,对于嵌套/多个 JOIN SQL 语句,是否应该始终首先使用 INNER JOIN(要么将其放在顶部行或通过使用括号首先 INNER JOIN 两个表)并确保它在任何 OUTER JOIN
我们有以下查询。使用 LEFT OUTER 连接需要 9 秒才能执行。将 LEFT OUTER 更改为 LEFT INNER 可将执行时间减少到 2 秒,并且返回相同行数。由于无论连接类型如何,都正在
为什么在实例化通用外部类(连同内部类)时使用菱形运算符会在代码段 2 中产生错误,而代码段 1 却完全没问题? 我知道稀有类型是被禁止的,但我的情况不是稀有类型——在稀有类型中,外部和内部都是通用的,
我有 4 个表,如下所示。 表:类 ClassID | ClassSTD -------------------------------- 1 | STD-1 2
是否有关于“外部 =>”功能的文档?它看起来像一个带有推断类型的自类型注释。然而我有一种感觉,我错了。 如果是这样,是否只是表达对 super 的访问的不同方式? ? trait A extends
我有 2 个表 users 和 orders,我想获取 users 和他的订单数 SELECT `users`.*, `orders`.*,count(*) FROM `users` LEFT JOI
我有一个非常古老的 informix 过程,我想在我的新 PostgreSQL 数据库中使用它。我是 Postgres 的新手,我觉得连接很不一样。 这是我的旧 Informix 代码的一部分: CR
我非常擅长 SQL 语句,希望能得到一点帮助。我发现我需要对其中一些表使用 OUTER 联接,但 MySQL 没有该功能。 SELECT validclick.Campaign
对,这有点令人困惑,我不确定通过 sql 是否可行。 我的第一个表叫做成员,我目前有这个 user:ID type: firstname: lastname: 这是表中的数据 members tabl
我是一名优秀的程序员,十分优秀!