unsigned int \ long
Roman Yakovenko
romany at actimize.com
Wed Aug 13 05:16:35 EDT 2003
1. Bitwise operations
~210 | 118 == -129
I'd like to get 127 ( of course if I work within byte or smth like this ).
Today in order to get it I have to write ( ~210 | 118 ) & 0xFF
2. Example
def print_selection( some_list, range=(0,-1) ):
lower = max( 0, range[0] )
upper = min( len( some_list ), unsigned_int( range[1] ) )
print some_list[lower:upper]
instead I have to write
def print_selection( some_list, range=(0,-1) ):
lower = max( 0, range[0] )
upper = range[1]
if upper < 0 or upper > len( some_list )
upper = len( some_list )
print some_list[lower:upper]
Thanks for help.
Roman.
> -----Original Message-----
> From: Andres Viikmaa [mailto:andresv at hot.ee]
> Sent: Wednesday, August 13, 2003 9:49 AM
> To: python-list at python.org
> Subject: Re: unsigned int \ long
>
>
> look module struct -- Interpret strings as packed binary data
>
> Andres
>
> "Roman Yakovenko" <romany at actimize.com> wrote in message
> news:mailman.1060753100.20465.python-list at python.org...
> Hi. I need to work with integer as unsigned integer, but
> I can't find documentation how can I do it.
>
> Some reference on this will be appreciated.
>
> For example (unsigned int)(-1) == 0xFFFFFFFF.
>
> Thanks.
>
> Roman.
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list