[Python-Dev] Sign of bytes

anatoly techtonik techtonik at gmail.com
Wed Oct 31 18:44:29 CET 2012


Hi,

I wonder why Python uses signed chars for bytes
http://docs.python.org/2/library/ctypes.html#ctypes.c_byte

This is a Java thing, but Java doesn't have unsigned types at all
http://en.wikipedia.org/wiki/Criticism_of_Java#Unsigned_integer_types

Windows implements BYTE as unsigned char, and it is in the same line as
WORD, DWORD etc. The way you look at memory contents in assembly.

byte type is also unsigned in .NET platform for all languages implementes,
and also has a sbyte counterpart.

When working with bytes in decimal system it is much more convenient to
operate with strictly positive values than with -128 - 127 (or is it -127
to 128?)


-- 
anatoly t.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20121031/c763b890/attachment.html>


More information about the Python-Dev mailing list