[Python-3000] Octal

Guido van Rossum guido at python.org
Wed Mar 14 15:59:03 CET 2007


I would miss them too (again, as unix perms, which have a large swath
of my brain tissue devoted to them through nearly 30 years of use) but
I see the problem that Raymond mentioned (one of his colleagues fell
into the trap -- he didn't make this up)

 I really don't like to have to write int('660', 8). How about 0t660?
This is most symmetric with 0xffe for hex, as it is the 3rd letter of
the word in both cases.

I think we also approved 0b101010 for binary numbers, didn't we? Other
bases don't have enough of a following to bother.

--Guido

On 3/14/07, Thomas Wouters <thomas at python.org> wrote:
>
> 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!
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe:
> http://mail.python.org/mailman/options/python-3000/guido%40python.org
>
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list