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

Baptiste Carvello baptiste13 at altern.org
Mon Mar 19 11:13:16 CET 2007


Patrick Maupin a écrit :

> 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.
> 
you don't analyse data files for a living, do you :-)

As a physicist, I have to open many kinds of data files with the weirdest
formats. Of course, some of them could not reasonably be supported by the python
builtins, but it doesn't have to be made unnecessary difficult either. "Be
liberal in what you accept".

However, I usually don't have to guess the base of my data, so this really
applies mostly to float(s), int(s), and int(s, base) with base != 0.

Cheers,
Baptiste



More information about the Python-3000 mailing list