Need "sum" compatible checksum16 in Python
Alex Martelli
aleaxit at yahoo.com
Sat May 12 11:49:07 EDT 2001
"Fredrik Lundh" <fredrik at pythonware.com> wrote in message
news:6faL6.1673$Yu6.413717 at newsc.telia.net...
> Alex Martelli wrote:
>
> > I'm not sure if ord() returns -128 to 127, or 0 to 255,
> > whence the &0xFF.
>
> misplaced your interpreter today? ;-)
Just a touch of occasional laziness:-).
> ord(char) returns the code points in the range 0..255
> for 8-bit strings (0..65535 for unicode strings).
OK, so it's useless (albeit innocuous) to & its result with
0xFF when it's dealing with single-byte characters, as
in the example I had coded.
Alex
More information about the Python-list
mailing list