Number format; newbie makes deep heartfelt whinge

A. Lloyd Flanagan alloydflanagan at attbi.com
Tue Feb 18 09:52:48 EST 2003


Gary Duncan <gmduncan at netspace.net.au> wrote in message news:<3E51E708.5010803 at netspace.net.au>...
> I kept getting "SyntaxError: invalid token" diagnostics when
> I ran the program, on certain tuples.
...
> The crux of the problem, as I belatedly discovered, was because each number
> had leading zeroes and were being interpreted as OCTAL numbers, and the
> diagnostic was occuring on the first number with a digit >7.
> 
> I've always felt that the C-convention of attempting to convert a number
> with a leading 0 to octal was one of the few stupidities that K & R could
> be accused of . Too bad that Python has to be locked into it via its
> dependency on the underlying C-libs.

Amazing.  I agree with you on the stupidity, I can think of a lot of
better ways to indicate octal numbers
+1  --  Better error message
+1  --  Removing the whole octal-if-it-starts-with-zero thing.  I
imagine this could break some code, so I don't hold out too much hope
for it.

>   bushfires DownUnder. No doubt you and other US Pythonistas are also busy
>   with snow shovels, and lining your plush mansions with plastic sheeting
>   and duct tape  :->

Yes, we've got snow shovels, but my plush mansion looks a lot like a
three-room apartment :).  And you can do all sorts of interesting
things with plastic sheeting and duct tape...




More information about the Python-list mailing list