> > high, low = ((num % 2**16) >> 8, num % 2**8)  or something thereabouts.

My take would be something like

high, low = (num >> 8) & 0xff , num & 0xff

In case you want another option.  This is probably more
efficient since you're not raising to powers or taking the
modulus, although for all I know Python may optimize that
in these special cases anyway.  

Also, unless Python is doing more than I think it does
to watch out for your safety behind the scenes, this
is more safe against sign extension errors.

-- 
Steve Willoughby    |  Using billion-dollar satellites
[EMAIL PROTECTED]   |  to hunt for Tupperware.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to