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

Patrick Maupin pmaupin at gmail.com
Mon Mar 19 02:39:54 CET 2007


On 3/18/07, Thomas Wouters <thomas at python.org> wrote:

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

I guess this is still an open item, then. My understanding is that Guido said "no uppercase", I asked about "X", he basically replied, "well, fine for data, if you must, but not code, because Google Code says that's not required", and I said...

Well, I thought I said "OK, thanks, we won't do it for either" but looking back, I see I didn't say that very well.

My opinion is that int(s, 0) should do the same as eval(). A string replace on a data file is actually much easier than on a code file, and it really is a one-liner, so the potential existence of upper case 'X' in the data file does not seem like reason enough to make these different.

However, if there strong sentiment that uppercase 'X' really needs to be supported, that needs to be a discussion for another PEP. This one got so big from the supported bases, and parse of "0123' as exception or int, discussions, that I deliberately left the lower-case only argument as subject matter for a different day. That argument encompasses 'r' and 'j', as well, which really doesn't have anything to do with numeric bases.

Regards, Pat



More information about the Python-3000 mailing list