> >>> 0xff & (((0xff & a) << 4) | (0xff & b)) > 150 > > or, if you're sloppy, > > >>> (a << 4) | b > 150
Slightly OT, maybe - why exactly is the second alternative 'sloppy?' I believe you, because I had a problem once (in Java) with bytes not having the value I expected unless I did the and-magic, but I wasn't clear on why. Is it an issue with the word otherwise possibly not being zeroed out? -dan -- http://mail.python.org/mailman/listinfo/python-list