S
Steven D'Aprano
It seems to me that the right choice for thousands seperator is the
apostrophe.
You mean the character already used as a string delimiter?
It seems to me that the right choice for thousands seperator is the
apostrophe.
Steven D'Aprano said:You mean the character already used as a string delimiter?
A problem is that '1234' in Python is a string, so using ' in numbers
looks a bit dangerous to me (and my editor will color those numbers as
alternated strings, I think).
Alexander said:Yeah, editors, especially those with crummy syntax highlighting (like emacs)
might get it wrong. This should be easy enough to fix though.
+1 on such a capability.
-1 on underscore as the separator.
When you proposed this last year, the counter-proposal was made
<URL:http://groups.google.com/group/comp.lang.python/msg/18123d100bba63b8?dmode=source>
to instead use white space for the separator, exactly as one can now
do with string literals.
Yuck.
Repeating a mistake means two mistakes.
But I would hate less the use of nobreak spaces, since any decent editor
can reveal them.
It's amazing that after over half a century of computing we still can't denote
numbers with more than 4 digits readably in the vast majority of contexts.
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.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.