简体   繁体   English

使用双方括号?

[英]Using double square brackets?

In a file using an older version of Python, I found the following piece of code: 在使用旧版Python的文件中,我找到了以下代码:

PROP_UI_COMBO = 'Prop_UI_ComboBox'
PROP_UI_COMBO[[]] = [_[1], [x for x in range(-1, 10)] + [26, 28, 30]]

And I'm wondering what it means to set PROP_UI_COMBO[[]] . 而且我想知道设置PROP_UI_COMBO[[]]意味着什么。 What do the double brackets mean? 双括号是什么意思? Also, (I may be wrong) I believe that _[1] is just the temporary list of [x for x in range(-1, 10)] . 另外,(我可能错了)我认为_[1]只是[x for x in range(-1, 10)]的临时列表。 So as my question presents, what is the [[]] for, and what is the equivalent in Python 3.4? 因此,正如我的问题所呈现的那样, [[]] 3.4 [[]]是什么,以及Python 3.4中的等价物是什么?

这两行不是由Python执行的 - 如果是,则会引发异常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM