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

Thomas Wouters thomas at python.org
Mon Mar 19 01:50:00 CET 2007


On 3/19/07, Georg Brandl <g.brandl at gmx.net> wrote:
>
> Patrick Maupin schrieb:
> > On 3/18/07, Georg Brandl <g.brandl at gmx.net> wrote:
> >> I just want to add that I've adapted and extended Thomas' original
> patch
> >> for the 0o123 syntax. It should be pretty complete.
> >>
> >> Open issues would probably be:
> >> - should int("0755", 0) give 0o755? (IMO yes)
> >
> > The PEP covers this, with the answer current of "yes" for 2.6 and
> > "exception" for 3.0.  (It presumes int(x, 0) should be the same as the
> > compiler tokenizer result.)
>
> It isn't. We already said that int() should continue to accept "0x" and
> "0X"
> prefixes for hexadecimal, for instance.


As far as I understood Guido, int(s, 16) should. int(s, 0) should not.

-- 
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/20070319/6cfb3411/attachment.htm 


More information about the Python-3000 mailing list