Oct-17-2016, 02:39 AM
(Oct-16-2016, 02:59 AM)Larz60+ Wrote: Hello,it's for unsigned (int is implied ... 32 bit in common platforms) in C. and works that way in Py, too:
You are correct, the u is for unsigned character. It originated in C as a data type, originally for an 8 bit byte, where you wanted to use the full 255 possible values.
Without it, the range would be -128 to 127.
Output:lt1/forums /home/forums 10> py2
Python 2.7.12 (default, Jul 1 2016, 15:12:24)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> '%u' % (2**30,)
'1073741824'
>>>
lt1/forums /home/forums 11> py3
Python 3.5.2 (default, Sep 10 2016, 08:21:44)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> '%u' % (2**30,)
'1073741824'
>>>
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.