The second element (in brackets) is the index that will be used for the first element. So, in this case, you have one tuple:
('http', 'https')
And then a boolean that represents whether self.https is self.https . If true, the value will be 1 , making the call:
('http', 'https')[1]
which selects the https value from the tuple. This exploits the fact that bool is a subclass of int , which could potentially be considered abuse :)
In [1]: t = ('http', 'https') In [2]: t[0] Out[2]: 'http' In [3]: t[1] Out[3]: 'https' In [4]: https_setting = True In [5]: int(https_setting) Out[5]: 1 In [6]: t[bool(https_setting)] Out[6]: 'https' In [7]: True.__class__.__bases__ Out[7]: (int,)
For a cool use of this technique, check out 2:14 in this video (which is also a great video of your choice!). It indexes a string ( '^ ' ) instead of a tuple, but the concept is the same.
source share