Re: [Python-Dev] Sign of bytes

2012-10-31 Thread Amaury Forgeot d'Arc
2012/10/31 anatoly techtonik : > I wonder why Python uses signed chars for bytes > http://docs.python.org/2/library/ctypes.html#ctypes.c_byte c_int is signed, c_uint is unsigned. similarly c_byte is signed, and c_ubyte is unsigned. > Windows implements BYTE as unsigned char, and it is in the same

Re: [Python-Dev] Sign of bytes

2012-10-31 Thread Xavier Morel
On 2012-10-31, at 18:44 , anatoly techtonik wrote: > I wonder why Python uses signed chars for bytes > http://docs.python.org/2/library/ctypes.html#ctypes.c_byte That's not Python, that's ctypes. struct[0] has no "bytes" it uses "char" for everything. If I had to guess, it would be because "char"

Re: [Python-Dev] Sign of bytes

2012-10-31 Thread anatoly techtonik
The thing that made me wonder is here - http://bugs.python.org/issue16376 When I inspect contents of Windows structures, I get negative values that are not present in MSDN. -- anatoly t. On Wed, Oct 31, 2012 at 7:44 PM, anatoly techtonik wrote: > Hi, > > I wonder why Python uses signed chars f

[Python-Dev] Sign of bytes

2012-10-31 Thread anatoly techtonik
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