Ross Ridge <[EMAIL PROTECTED]> said: > If you have Python 2.5, here's a faster version: > > from struct import * > unpack_i32be = Struct(">l").unpack > > def from3Bytes_ross2(s): > return unpack_i32be(s + "\0")[0] >> 8
Bob Greschke <[EMAIL PROTECTED]> wrote: > That's not even intelligible. I wanna go back to COBOL. :) It's the same as the previous version except that it "precompiles" the struct.unpack() format string. It works similar to the way Python handles regular expressions. Ross Ridge -- l/ // Ross Ridge -- The Great HTMU [oo][oo] [EMAIL PROTECTED] -()-/()/ http://www.csclub.uwaterloo.ca/~rridge/ db // -- http://mail.python.org/mailman/listinfo/python-list