What steps will reproduce the problem?
x=[1,2]
#this is a possible workaround
print(x[1] if True else x[0])
#all these standard python expressions fail
print( x[4>2])
print(x[int(True)])
print(x[True])
What is the expected output? What do you see instead?
expected the number 2 printed four times
instead got an error:
2
TypeError: list indices must be integer, not <class 'bool'>
module '__main__' line 3
print( x[2>4])
<done in 23 ms>
What version of the product are you using? On what operating system?
Brython online console 24/01/2013
Please provide any additional information below.
Used for failproof execution in list comprehension
Original issue reported on code.google.com by cet...@gmail.com on 24 Jan 2013 at 1:22
Original issue reported on code.google.com by
cet...@gmail.com
on 24 Jan 2013 at 1:22