Numeric literal syntax

glen stark mail at nospam.glenstark.net
Tue Sep 9 03:31:12 EDT 2008


On Tue, 09 Sep 2008 08:32:29 +1000, Tom Harris wrote:

> I agree. So did Forth's early designers. That is why Forth's number
> parser considers a word that starts with a number and has embedded
> punctuation to be a 32 bit integer, and simply ignores the punctuation.
> I haven't used Forth in years, but it seems a neat solution to the
> problem of decoding a long string of numbers: let the user put in
> whatever they want, the parser ignores it. I usually used a comma (with
> no surrounding whitespace of course), but it was your choice. You could
> also do this in whatever base you were working in, so you could
> punctuate a 32 bit hex number to correspond to the bit fields inside it.
> Of course not applicable to Python.


That sounds like a great idea, except I'd specify non-period (.) 
punctuation, so it would go for floating points as well.  

Is there a language design guru who can say why inputs like 123,456.00 
couldn't be handles as above?  the only problem I can see is an abiguity 
in argument lists (e.g. mult(2,4) ) which could be handled by the 
inclusion of whitespace.



More information about the Python-list mailing list