3

In a file using an older version of Python, I found the following piece of code:

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[[]]. 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)]. So as my question presents, what is the [[]] for, and what is the equivalent in Python 3.4?

Zach Gates
  • 4,045
  • 1
  • 27
  • 51
  • `_[1]` This isn't a correct Syntax in Python. –  Jan 04 '15 at 04:56
  • 1
    [It is a temporary name used in a list comprehension by Python 2.6 and earlier.](http://stackoverflow.com/a/9632177/3496038) @NoMorePuppies – Zach Gates Jan 04 '15 at 04:57
  • Found a reference [here](http://stackoverflow.com/a/9632177/3496038). @kojiro – Zach Gates Jan 04 '15 at 05:03
  • 1
    I couldn't even get the code to run in 2.5 http://codepad.org/wXRfuLF3, or on 2.6 on http://www.trypython.org/. You're trying to assign to a string, that shouldn't be possible. – TankorSmash Jan 04 '15 at 06:12

1 Answers1

0

Those two lines are not executed by Python -- if they were, an exception would be raised.

Ethan Furman
  • 63,992
  • 20
  • 159
  • 237