Using Python 2.6, is there a way to check if all the items of a sequence equals a given value, in one statement?
[pseudocode]
my_sequence = (2,5,7,82,35)
if
I would suggest:
if all(isinstance(i, int) for i in my_list):
all and any first appeared in 2006 with Python 2.5 (feature implemented by Raymond Hettinger).
If you're using an older version of Python, the links provide sample implementations.
I also suggest using isinstance since it will also catch subclasses of int.