0
I like doing such all-in-range checks like this: 0 <= min(nums) <= max(nums) <= 255 That's usually faster. Measuring a little: >>> from timeit import timeit >>> timeit('0 <= min(nums) <= max(nums) <= 255', 'nums = range(256)') 10.911965313750706 >>> timeit('all(0 <= n <= 255 for n in nums)',...