python - Python无法解析变量,鸭子打字说?
问题描述
我已将我的变量定义如下;
timestamp_set = set([])
def doUpdate():
if len(timestamp_set) == 0:
tset = get3daysoffset()
timestamp_set = tset <---If this line removed no error warnings
在上面的代码块中,它说 if 条件中的 timestamp_set 变量无法解析;
Unresolved reference 'timestamp_set' less... (⌘F1)
This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items
如果我删除timestamp_set = tset
行,pycharm 没有显示任何错误警告。这里有什么问题?
解决方案
推荐阅读
- apache-spark - Spark驱动程序以集群模式登录边缘节点
- java - TemplateResolver 未添加到 TemplateEngine
- python - Python pip 搞砸了
- ios - “参数传递给不带参数的调用”实例化 HKWorkoutRouteQuery
- angularjs - ng-model for `
我将 AngularJS 用于一个简单的网络。我正在训练配置表单验证,但在模型中存储输入的 de 值时遇到问题。
代码是这样的
<div class="login-form"> {{login}} <form name="l
- elasticsearch - 多匹配不适用于恒定分数
- jquery - JQuery:使用刚刚由 Click 函数添加的鼠标输入选择器
- python - 如何用 iterparse 编写?
- kendo-ui - Kendo UI 样式在 .NET Core 中不起作用
- angular - 从服务器角度重新加载数据