[Python-3000] Octal

Thomas Wouters thomas at python.org
Wed Mar 14 10:59:30 CET 2007


On 3/14/07, Raymond Hettinger <python at rcn.com> wrote:
>
> Now that the 20th century is safely behind us, do we still want literals
> with leading zeroes to be interpreted as octal?


What, this again? Without reading the rest of the thread I just know it'll
devolve into discussion about arbitrary-base-integer-literals :-) (Ok, I
snuck a peak just to make sure I won't get egg on my face.)

I'm -1 on removing octal and hexadecimal literals, as I do use them both,
and because of the fact that many, many other languages also use them. Some
things are just stumbling blocks. FWIW, we get a great many complete-newbie
questions on #python, and I do not believe I've *ever* seen anyone surprised
about octal literals. They're surprised about other representation issues,
like "€" coming out as "\xe2\x82\xac", every now and then about how to
handle 'binary literals' and occasionally about os.chmod(755) not doing the
right thing, but never about 010 coming out wrong. Oh, that's not entirely
true: once, someone complained that 0101110 didn't come out right, but the
problem wasn't the leading 0: he expected it to be interpreted as a binary
number and come out as 46, and was equally surprised by 1101110. (Boy, did
we have a hell of a time convincing that guy.)

(And no, I don't think the number of questions #python gets about binary
literals is enough to warrant binary literals. They're invariably new
programmers tackling the problem as an exercise, or trying to get at the
'pure bits' of an int to perform bitwise operations in an inefficient
manner.)

-- 
Thomas Wouters <thomas at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20070314/229296e0/attachment.html 


More information about the Python-3000 mailing list