[Tutor] unsigned int or char equivalent in Python?

Alan Gauld alan.gauld at btinternet.com
Tue Feb 4 17:26:18 CET 2014


On 04/02/14 15:01, Peter Otten wrote:
> Alan Gauld wrote:

>> This led me to wonder if there is a way to get unsigned type
>> behaviour in Python?
>>
> I think you have to apply a mask:
>
>>>> -2 & 0xff
> 254

Ah! obvious when you see it! :-)

And I'm applying masks all over the place but didn't
think of using it here.

Thanks,

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list