Re: Numeric literal syntax

2008-09-09 Thread glen stark
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,

Re: Numeric literal syntax

2008-09-08 Thread Tom Harris
On Thu, Sep 4, 2008 at 10:22 AM, Alexander Schmolck [EMAIL PROTECTED] wrote: 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

Re: Numeric literal syntax

2008-09-06 Thread Alan G Isaac
[EMAIL PROTECTED] writes: For Python 2.7/3.1 I'd now like to write a PEP regarding the underscores into the number literals, like: 0b_0101_, 268_435_456 etc. +1 on such a capability. -1 on underscore as the separator. On 9/1/2008 9:13 PM Ben Finney apparently wrote: When you proposed

Re: Numeric literal syntax

2008-09-06 Thread Steven D'Aprano
On Sat, 06 Sep 2008 23:30:03 +, Alan G Isaac wrote: [EMAIL PROTECTED] writes: For Python 2.7/3.1 I'd now like to write a PEP regarding the underscores into the number literals, like: 0b_0101_, 268_435_456 etc. +1 on such a capability. -1 on underscore as the separator. On

Re: Numeric literal syntax

2008-09-04 Thread Alexander Schmolck
Steven D'Aprano [EMAIL PROTECTED] writes: On Thu, 04 Sep 2008 01:22:22 +0100, Alexander Schmolck wrote: It seems to me that the right choice for thousands seperator is the apostrophe. You mean the character already used as a string delimiter? Yup. No ambiguity or problem here; indeed

Re: Numeric literal syntax

2008-09-04 Thread Alexander Schmolck
[EMAIL PROTECTED] writes: 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). Yeah, editors, especially those with crummy syntax highlighting (like emacs) might get it wrong.

Re: Numeric literal syntax

2008-09-04 Thread Fredrik Lundh
Alexander Schmolck wrote: 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). Yeah, editors, especially those with crummy syntax highlighting (like emacs) might get it wrong.

Re: Numeric literal syntax

2008-09-03 Thread Grant Edwards
On 2008-09-02, Christian Heimes [EMAIL PROTECTED] wrote: Fredrik Lundh wrote: Peter Pearson wrote: (startled noises) It is a delight to find a reference to that half-century-old essay (High Finance) by the wonderful C. Northcote Parkinson, but how many readers will catch the allusion?

Re: Numeric literal syntax

2008-09-03 Thread Grant Edwards
On 2008-09-03, Ben Finney [EMAIL PROTECTED] wrote: Ben Finney [EMAIL PROTECTED] writes: I don't see any good reason (other than your familiarity with the D language) to use underscores for this purpose, and much more reason (readability, consistency, fewer arbitrary differences in syntax,

Re: Numeric literal syntax

2008-09-03 Thread Grant Edwards
On 2008-09-03, Ben Finney [EMAIL PROTECTED] wrote: Another reason in support of spaces (rather than underscores) to separate digit groups: it's the only separator that follows the SI standard for representing numbers: ??? for numbers with many digits the digits may be divided into

Re: Numeric literal syntax

2008-09-03 Thread bearophileHUGS
Ben Finney: … for numbers with many digits the digits may be divided into groups of three by a thin space, in order to facilitate reading. Neither dots nor commas are inserted in the spaces between groups of three.

Re: Numeric literal syntax

2008-09-03 Thread Cliff
On Sep 2, 12:34 am, Fredrik Lundh [EMAIL PROTECTED] wrote: Ben Finney wrote: I would argue that the precedent, already within Python, for using a space to separate pieces of a string literal, is more important than precedents from other programming languages. that precedent also tells us

Re: Numeric literal syntax

2008-09-03 Thread Alexander Schmolck
Ben Finney [EMAIL PROTECTED] writes: [EMAIL PROTECTED] writes: For Python 2.7/3.1 I'd now like to write a PEP regarding the underscores into the number literals, like: 0b_0101_, 268_435_456 etc. +1 on such a capability. -1 on underscore as the separator. When you proposed this last

Re: Numeric literal syntax

2008-09-03 Thread bearophileHUGS
Alexander Schmolck: It also reads well, unlike the underscore which is visually obstrusive and ugly (compare 123'456'890 to 123_456_789). I like that enough, in my language that symbol is indeed the standard one to separate thousands, in large numbers. It's light, looks natural, and as you say

Re: Numeric literal syntax

2008-09-03 Thread Steven D'Aprano
On Thu, 04 Sep 2008 01:22:22 +0100, Alexander Schmolck wrote: It seems to me that the right choice for thousands seperator is the apostrophe. You mean the character already used as a string delimiter? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

RE: Numeric literal syntax

2008-09-03 Thread Delaney, Timothy (Tim)
Steven D'Aprano wrote: On Thu, 04 Sep 2008 01:22:22 +0100, Alexander Schmolck wrote: It seems to me that the right choice for thousands seperator is the apostrophe. You mean the character already used as a string delimiter? Hey - I just found a new use for the backtick! 123`456`7890

Re: Numeric literal syntax (was: Py 2.6 changes)

2008-09-02 Thread Steven D'Aprano
On Tue, 02 Sep 2008 11:13:27 +1000, Ben Finney wrote: [EMAIL PROTECTED] writes: For Python 2.7/3.1 I'd now like to write a PEP regarding the underscores into the number literals, like: 0b_0101_, 268_435_456 etc. +1 on such a capability. -1 on underscore as the separator. When

Re: Numeric literal syntax

2008-09-02 Thread Steven D'Aprano
On Mon, 01 Sep 2008 22:11:13 -0700, Dennis Lee Bieber wrote: On Tue, 02 Sep 2008 13:51:16 +1000, Ben Finney [EMAIL PROTECTED] declaimed the following in comp.lang.python: This is no more the case than for literal strings: a = spam eggs ham a = spam, eggs, ham But... Literal string

Re: Numeric literal syntax (was: Py 2.6 changes)

2008-09-02 Thread Nick Craig-Wood
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Ben Finney: I don't see any good reason (other than your familiarity with the D language) to use underscores for this purpose, and much more reason (readability, consistency, fewer arbitrary differences in syntax, perhaps simpler implementation)

Re: Numeric literal syntax (was: Py 2.6 changes)

2008-09-02 Thread Peter Pearson
On 02 Sep 2008 06:10:51 GMT, Steven D'Aprano wrote: At the risk of bike-shedding, [snip] (startled noises) It is a delight to find a reference to that half-century-old essay (High Finance) by the wonderful C. Northcote Parkinson, but how many readers will catch the allusion? -- To email me,

Re: Numeric literal syntax

2008-09-02 Thread Alan G Isaac
On 02 Sep 2008 06:10:51 GMT, Steven D'Aprano wrote: At the risk of bike-shedding, [snip] Peter Pearson wrote: (startled noises) It is a delight to find a reference to that half-century-old essay (High Finance) by the wonderful C. Northcote Parkinson, but how many readers will catch the

Re: Numeric literal syntax

2008-09-02 Thread Fredrik Lundh
Peter Pearson wrote: (startled noises) It is a delight to find a reference to that half-century-old essay (High Finance) by the wonderful C. Northcote Parkinson, but how many readers will catch the allusion? anyone that's been involved in open source on the development side for more than,

Re: Numeric literal syntax

2008-09-02 Thread Peter Pearson
On Tue, 02 Sep 2008 17:18:58 GMT, Alan G Isaac [EMAIL PROTECTED] wrote: On 02 Sep 2008 06:10:51 GMT, Steven D'Aprano wrote: At the risk of bike-shedding, [snip] Peter Pearson wrote: (startled noises) It is a delight to find a reference to that half-century-old essay (High Finance) by the

Re: Numeric literal syntax

2008-09-02 Thread Christian Heimes
Fredrik Lundh wrote: Peter Pearson wrote: (startled noises) It is a delight to find a reference to that half-century-old essay (High Finance) by the wonderful C. Northcote Parkinson, but how many readers will catch the allusion? anyone that's been involved in open source on the development

Re: Numeric literal syntax

2008-09-02 Thread Ben Finney
Peter Pearson [EMAIL PROTECTED] writes: I thought I was a geek, for the past 40 years; but maybe its time for me to be demoted to the dad on whose bookshelf you'll find that old book. Once a geek, always a geek. You either stay sharp or get sloppy, but you never stop being a geek :-) -- \

Re: Numeric literal syntax (was: Py 2.6 changes)

2008-09-02 Thread Patrick Maupin
On Sep 2, 6:35 am, Nick Craig-Wood [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:  It's not just my familiarity, Ada language too uses underscore for  that purpose, I think, so there's a precedent, and Ada is a language  designed to always minimize programming errors,

Re: Numeric literal syntax

2008-09-02 Thread Ben Finney
Ben Finney [EMAIL PROTECTED] writes: I don't see any good reason (other than your familiarity with the D language) to use underscores for this purpose, and much more reason (readability, consistency, fewer arbitrary differences in syntax, perhaps simpler implementation) to use whitespace just

Numeric literal syntax (was: Py 2.6 changes)

2008-09-01 Thread Ben Finney
[EMAIL PROTECTED] writes: For Python 2.7/3.1 I'd now like to write a PEP regarding the underscores into the number literals, like: 0b_0101_, 268_435_456 etc. +1 on such a capability. -1 on underscore as the separator. When you proposed this last year, the counter-proposal was made

Re: Numeric literal syntax (was: Py 2.6 changes)

2008-09-01 Thread bearophileHUGS
Ben Finney: I don't see any good reason (other than your familiarity with the D language) to use underscores for this purpose, and much more reason (readability, consistency, fewer arbitrary differences in syntax, perhaps simpler implementation) to use whitespace just as with string literals.

Re: Numeric literal syntax

2008-09-01 Thread Ben Finney
[EMAIL PROTECTED] writes: Ben Finney: I don't see any good reason (other than your familiarity with the D language) to use underscores for this purpose, and much more reason (readability, consistency, fewer arbitrary differences in syntax, perhaps simpler implementation) to use

Re: Numeric literal syntax

2008-09-01 Thread Fredrik Lundh
Ben Finney wrote: I would argue that the precedent, already within Python, for using a space to separate pieces of a string literal, is more important than precedents from other programming languages. that precedent also tells us that the whitespace approach is a common source of errors.