[Python-3000] String literal representation of integers (octal/binary discussion)

Guido van Rossum guido at python.org
Mon Mar 19 17:38:43 CET 2007


The point was not to reopen the discussion; we've had the discussion
and the outcome is clear. The point was, what should be justified in
the PEP.

On 3/18/07, Jim Jewett <jimjjewett at gmail.com> wrote:
> On 3/18/07, Guido van Rossum <guido at python.org> wrote:
> > Octal does need to be justified, since some people argued to remove
> > it. I guess binary needs to be justified because Thomas doesn't see
> > the need. :-)
>
> I see literals for octal and binary as similar to raising a tuple, or
> automatically unpacking one in a function call.  It can be useful, but
> it isn't needed very often.  When it does show up, it can be confusing
> *because* it is so rare.
>
> If I were only worried about one program, I would prefer to write:
>
>     >>> oct(78) == "0o116"
>
> rather than:
>
>     >>> from math import oct
>     >>> oct(78) == int("123", 8)
>
> The preference isn't really overwhelming, though, and the use isn't
> very frequent.  This doesn't seem like a big enough win to justify any
> extra complexity in the language.
>
> (And no, I wouldn't add hex either, but not adding is different from removing.)
>
> -jJ
>


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


More information about the Python-3000 mailing list