Re: Annoying octal notation

2009-09-04 Thread NevilleDNZ
On Sep 3, 2:57 pm, James Harris wrote: > On 3 Sep, 14:26, Albert van der Horst > wrote: > > > In article > > <6031ba08-08c8-416b-91db-ce8ff57ae...@w6g2000yqw.googlegroups.com>, > > James Harris   wrote: > > > > > >So you are saying that Smalltalk has r where > > >r is presumably for radix? That

Re: Annoying octal notation

2009-09-03 Thread MRAB
Albert van der Horst wrote: In article <6b5ea596-d1e3-483d-ba79-7b139d3c7...@z24g2000yqb.googlegroups.com>, Bearophile wrote: MRAB: '_': what if in the future we want to allow them in numbers for clarity? Hettinger says it's hard (= requires too many changes) to do that and Python programs

Re: Annoying octal notation

2009-09-03 Thread James Harris
On 3 Sep, 15:54, Albert van der Horst wrote: > In article , > Derek Martin   wrote: > > > > > > >--W1uEbMXJ1Mj4g6TI > >Content-Type: text/plain; charset=iso-8859-1 > >Content-Disposition: inline > > >On Mon, Aug 24, 2009 at 05:03:28PM +, Steven D'Aprano wrote: > >> On Mon, 24 Aug 2009 11:21:46

Re: Annoying octal notation

2009-09-03 Thread James Harris
On 3 Sep, 15:35, Grant Edwards wrote: ... > >>> Obviously I can't speak for Ken Thompson's motivation in creating this > >>> feature, but I'm pretty sure it wasn't to save typing or space on > >>> punchcards. Even in 1969, hex was more common than octal, and yet hex > >>> values are written with

Re: Annoying octal notation

2009-09-03 Thread James Harris
On 3 Sep, 14:26, Albert van der Horst wrote: > In article <6031ba08-08c8-416b-91db-ce8ff57ae...@w6g2000yqw.googlegroups.com>, > James Harris   wrote: > > > > > >So you are saying that Smalltalk has r where > >r is presumably for radix? That's maybe best of all. It preserves the > >syntactic requi

Re: Annoying octal notation

2009-09-03 Thread Grant Edwards
On 2009-09-03, Albert van der Horst wrote: > In article , > MRAB wrote: >>Steven D'Aprano wrote: > >>> Obviously I can't speak for Ken Thompson's motivation in creating this >>> feature, but I'm pretty sure it wasn't to save typing or space on >>> punchcards. Even in 1969, hex was more common th

Re: Annoying octal notation

2009-09-03 Thread Albert van der Horst
In article , Derek Martin wrote: > >--W1uEbMXJ1Mj4g6TI >Content-Type: text/plain; charset=iso-8859-1 >Content-Disposition: inline > >On Mon, Aug 24, 2009 at 05:03:28PM +, Steven D'Aprano wrote: >> On Mon, 24 Aug 2009 11:21:46 -0500, Derek Martin wrote: >> > since the old syntax is prevalent b

Re: Annoying octal notation

2009-09-03 Thread Albert van der Horst
In article <6b5ea596-d1e3-483d-ba79-7b139d3c7...@z24g2000yqb.googlegroups.com>, Bearophile wrote: >MRAB: > >>'_': what if in the future we want to allow them in numbers for clarity? > >Hettinger says it's hard (= requires too many changes) to do that and >Python programs don't have big integer co

Re: Annoying octal notation

2009-09-03 Thread sjm
On Aug 21, 2:45 pm, John Nagle wrote: >      In 2009, Unisys finally exited the mainframe hardware business, and the > last of the 36-bit machines, the ClearPath servers, are being phased out. > That line of machines goes back to the UNIVAC 2200 series, and the UNIVAC > 1100 series, all the way b

Re: Annoying octal notation

2009-09-03 Thread Albert van der Horst
In article , MRAB wrote: >Steven D'Aprano wrote: >> Obviously I can't speak for Ken Thompson's motivation in creating this >> feature, but I'm pretty sure it wasn't to save typing or space on >> punchcards. Even in 1969, hex was more common than octal, and yet hex >> values are written with 0x.

Re: Annoying octal notation

2009-09-03 Thread Albert van der Horst
In article <6031ba08-08c8-416b-91db-ce8ff57ae...@w6g2000yqw.googlegroups.com>, James Harris wrote: > >So you are saying that Smalltalk has r where >r is presumably for radix? That's maybe best of all. It preserves the >syntactic requirement of starting a number with a digit and seems to >have gr

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-30 Thread Mel
Mensanator wrote: [ ... ] >> If you want your data file to have values entered in hex, or oct, or even >> unary (1=one, 11=two, 111=three, =four...) you can. > > Unary? I think you'll find that Standard Positional Number > Systems are not defined for radix 1. It has to be tweaked. If the onl

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-30 Thread Piet van Oostrum
> Mensanator (M) wrote: >M> That's my point. Since the common usage of "binary" is for >M> Standard Positional Number System of Radix 2, it follows >M> that "unary" is the common usage for Standard Positional >M> Number System of Radix 1. That's VERY confusing since such >M> a system is undef

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-30 Thread Steven D'Aprano
On Thu, 27 Aug 2009 10:49:27 -0700, Mensanator wrote: > Fine. I'm over it. Point is, I HAVE encountered plenty of people who > DON'T properly understand it, Marilyn Vos Savant, for example. I'm curious -- please explain. Links please? > You can't > blame me for thinking you don't understand it

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-30 Thread Mensanator
On Aug 26, 4:59 pm, Piet van Oostrum wrote: > > Mensanator (M) wrote: > >M> That's my point. Since the common usage of "binary" is for > >M> Standard Positional Number System of Radix 2, it follows > >M> that "unary" is the common usage for Standard Positional > >M> Number System of Radix 1.

Re: Annoying octal notation

2009-08-30 Thread Hendrik van Rooyen
On Monday 24 August 2009 16:14:25 Derek Martin wrote: > In fact, now that I think of it... > > I just looked at some old school papers I had tucked away in a family > album. I'm quite sure that in grammar school, I was tought to use a > date format of 8/9/79, without leading zeros. I can't prove

Re: Annoying octal notation

2009-08-29 Thread Grant Edwards
On 2009-08-28, Neil Hodgson wrote: > Steven D'Aprano: > >> Obviously I can't speak for Ken Thompson's motivation in creating this >> feature, but I'm pretty sure it wasn't to save typing or space on >> punchcards. > >The original implementation of UNIX was on a PDP-7 which was an > 18-bit ma

Re: Annoying octal notation

2009-08-28 Thread Neil Hodgson
Steven D'Aprano: > Obviously I can't speak for Ken Thompson's motivation in creating this > feature, but I'm pretty sure it wasn't to save typing or space on > punchcards. The original implementation of UNIX was on a PDP-7 which was an 18-bit machine. Octal = 3 bits at a a time which evenly

Re: Annoying octal notation

2009-08-28 Thread MRAB
Steven D'Aprano wrote: On Thu, 27 Aug 2009 10:31:04 -0700, Ethan Furman wrote: Steven D'Aprano wrote: A mistake is still a mistake even if it shared with others. Treating its with a lead zero as octal was a design error when it was first thought up [snippage] I have to disagree with you on

Re: Annoying octal notation

2009-08-28 Thread Steven D'Aprano
On Thu, 27 Aug 2009 10:31:04 -0700, Ethan Furman wrote: > Steven D'Aprano wrote: >> A mistake is still a mistake even if it shared with others. >> >> Treating its with a lead zero as octal was a design error when it was >> first thought up > > [snippage] > > I have to disagree with you on this

Re: Annoying octal notation

2009-08-27 Thread Mel
Steven D'Aprano wrote: > Leading zeroes in decimal numbers are *very* common in dates and times. In banking too, according to someone at work today. Mel. -- http://mail.python.org/mailman/listinfo/python-list

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-27 Thread Mensanator
On Aug 27, 2:26 pm, Piet van Oostrum wrote: > > Mensanator (M) wrote: > >M> On Aug 26, 4:59 pm, Piet van Oostrum wrote: > >>> > Mensanator (M) wrote: > >>> >M> That's my point. Since the common usage of "binary" is for > >>> >M> Standard Positional Number System of Radix 2, it follows >

Re: Annoying octal notation

2009-08-27 Thread Ethan Furman
MRAB wrote: Ethan Furman wrote: Steven D'Aprano wrote: A mistake is still a mistake even if it shared with others. Treating its with a lead zero as octal was a design error when it was first thought up [snippage] I have to disagree with you on this one. The computing world was vastly

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-27 Thread Piet van Oostrum
> Mensanator (M) wrote: >M> On Aug 26, 4:59 pm, Piet van Oostrum wrote: >>> > Mensanator (M) wrote: >>> >M> That's my point. Since the common usage of "binary" is for >>> >M> Standard Positional Number System of Radix 2, it follows >>> >M> that "unary" is the common usage for Standard P

Re: Annoying octal notation

2009-08-27 Thread Ethan Furman
James Harris wrote: On 27 Aug, 18:31, Ethan Furman wrote: Steven D'Aprano wrote: A mistake is still a mistake even if it shared with others. Treating its with a lead zero as octal was a design error when it was first thought up [snippage] I have to disagree with you on this one. Th

Re: Annoying octal notation

2009-08-27 Thread James Harris
On 27 Aug, 18:31, Ethan Furman wrote: > Steven D'Aprano wrote: > > A mistake is still a mistake even if it shared with others. > > > Treating its with a lead zero as octal was a design error when it was > > first thought up > > [snippage] > > I have to disagree with you on this one.  The computi

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-27 Thread Mensanator
On Aug 26, 10:27 pm, Steven D'Aprano wrote: > On Wed, 26 Aug 2009 18:53:04 -0700, Erik Max Francis wrote: > >> In any case, unary is the standard term for what I'm discussing: > > >>http://en.wikipedia.org/wiki/Unary_numeral_system > This really isn't anywhere near as controversial as you guys

Re: Annoying octal notation

2009-08-27 Thread MRAB
Ethan Furman wrote: Steven D'Aprano wrote: A mistake is still a mistake even if it shared with others. Treating its with a lead zero as octal was a design error when it was first thought up [snippage] I have to disagree with you on this one. The computing world was vastly different when

Re: Annoying octal notation

2009-08-27 Thread Ethan Furman
Steven D'Aprano wrote: A mistake is still a mistake even if it shared with others. Treating its with a lead zero as octal was a design error when it was first thought up [snippage] I have to disagree with you on this one. The computing world was vastly different when that design decision

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-26 Thread Steven D'Aprano
On Wed, 26 Aug 2009 18:53:04 -0700, Erik Max Francis wrote: >> In any case, unary is the standard term for what I'm discussing: >> >> http://en.wikipedia.org/wiki/Unary_numeral_system >> >> although Mathworld doesn't seem to know it. > > Psst. That's a hint. > > Googling for "unary number sys

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-26 Thread Erik Max Francis
Steven D'Aprano wrote: On Wed, 26 Aug 2009 10:58:12 -0700, Mensanator wrote: But I certainly wouldn't call it "binary", for fear of confusion with radix-2 binary. That's my point. Since the common usage of "binary" is for Standard Positional Number System of Radix 2, it follows that "unary" is

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-26 Thread Steven D'Aprano
On Thu, 27 Aug 2009 01:34:10 +, Steven D'Aprano wrote: > On Wed, 26 Aug 2009 10:58:12 -0700, Mensanator wrote: > >>> But I certainly wouldn't call it "binary", for fear of confusion with >>> radix-2 binary. >> >> That's my point. Since the common usage of "binary" is for Standard >> Position

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-26 Thread Steven D'Aprano
On Wed, 26 Aug 2009 10:58:12 -0700, Mensanator wrote: >> But I certainly wouldn't call it "binary", for fear of confusion with >> radix-2 binary. > > That's my point. Since the common usage of "binary" is for Standard > Positional Number System of Radix 2, it follows that "unary" is the > common

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-26 Thread Mensanator
On Aug 26, 9:58 am, Steven D'Aprano wrote: > On Tue, 25 Aug 2009 11:45:28 -0700, Mensanator wrote: > > On Aug 25, 9:14 am, Steven D'Aprano > cybersource.com.au> wrote: > >> On Mon, 24 Aug 2009 18:01:38 -0700, Mensanator wrote: > >> >> If you want your data file to have values entered in hex, or o

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-26 Thread Steven D'Aprano
On Tue, 25 Aug 2009 11:45:28 -0700, Mensanator wrote: > On Aug 25, 9:14 am, Steven D'Aprano cybersource.com.au> wrote: >> On Mon, 24 Aug 2009 18:01:38 -0700, Mensanator wrote: >> >> If you want your data file to have values entered in hex, or oct, or >> >> even unary (1=one, 11=two, 111=three, 11

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-25 Thread James Harris
On 24 Aug, 03:49, Dennis Lee Bieber wrote: ... > > Here's another suggested number literal format. First, keep the > > familar 0x and 0b of C and others and to add 0t for octal. (T is the > >thirdletter of octal as X is thethirdletter of hex.) The numbers > > above would be > >         The thing

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-25 Thread Mensanator
On Aug 25, 9:14 am, Steven D'Aprano wrote: > On Mon, 24 Aug 2009 18:01:38 -0700, Mensanator wrote: > >> If you want your data file to have values entered in hex, or oct, or > >> even unary (1=one, 11=two, 111=three, =four...) you can. > > > Unary? I think you'll find that Standard Positional N

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-25 Thread Steven D'Aprano
On Mon, 24 Aug 2009 18:01:38 -0700, Mensanator wrote: >> If you want your data file to have values entered in hex, or oct, or >> even unary (1=one, 11=two, 111=three, =four...) you can. > > Unary? I think you'll find that Standard Positional Number Systems are > not defined for radix 1. Of c

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-25 Thread James Harris
On 25 Aug, 01:25, Steven D'Aprano wrote: > On Mon, 24 Aug 2009 16:23:06 -0700, James Harris wrote: > > Sure but while I wouldn't normally want to type something as obscure as > > 32"rst" into a file of data I might want to type 0xff00 or similar. That > > is far clearer than 65280 in some cases.

Re: Annoying octal notation

2009-08-24 Thread Mensanator
On Aug 24, 10:20�pm, Erik Max Francis wrote: > Steven D'Aprano wrote: > > On Mon, 24 Aug 2009 09:14:25 -0500, Derek Martin wrote: > > >> Assuming I'm right about that, then the use of a leading 0 to represent > >> octal actually predates the prevalence of using 0 in dates by almost two > >> decade

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread Mensanator
On Aug 24, 8:21�pm, Mel wrote: > Mensanator wrote: > > [ ... ] > > >> If you want your data file to have values entered in hex, or oct, or even > >> unary (1=one, 11=two, 111=three, =four...) you can. > > > Unary? I think you'll find that Standard Positional Number > > Systems are not defined

Re: Annoying octal notation

2009-08-24 Thread Erik Max Francis
Steven D'Aprano wrote: On Mon, 24 Aug 2009 09:14:25 -0500, Derek Martin wrote: Assuming I'm right about that, then the use of a leading 0 to represent octal actually predates the prevalence of using 0 in dates by almost two decades. And while using leading zeros in other contexts is "familiar"

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread Mensanator
On Aug 24, 7:25 pm, Steven D'Aprano wrote: > On Mon, 24 Aug 2009 16:23:06 -0700, James Harris wrote: > > Sure but while I wouldn't normally want to type something as obscure as > > 32"rst" into a file of data I might want to type 0xff00 or similar. That > > is far clearer than 65280 in some cases.

Re: Annoying octal notation

2009-08-24 Thread Steven D'Aprano
On Mon, 24 Aug 2009 12:40:24 -0500, Derek Martin wrote: > On Mon, Aug 24, 2009 at 05:03:28PM +, Steven D'Aprano wrote: >> On Mon, 24 Aug 2009 11:21:46 -0500, Derek Martin wrote: >> > since the old syntax is prevalent both within and without the Python >> > community, making the change is, was,

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread Steven D'Aprano
On Mon, 24 Aug 2009 16:23:06 -0700, James Harris wrote: > Sure but while I wouldn't normally want to type something as obscure as > 32"rst" into a file of data I might want to type 0xff00 or similar. That > is far clearer than 65280 in some cases. > > My point was that int('ff00', 16) is OK for t

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread James Harris
On 24 Aug, 14:05, Mel wrote: > James Harris wrote: > > On 24 Aug, 02:19, Max Erickson wrote: > [ ... ] > >> >>> int('100', 3) > >> 9 > >> >>> int('100', 36) > >> 1296 > > > This is fine typed into the language directly but couldn't be entered > > by the user or read-in from or written to a file.

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Mon, Aug 24, 2009 at 04:40:14PM -0300, Gabriel Genellina wrote: > En Mon, 24 Aug 2009 14:40:24 -0300, Derek Martin > escribió: > > >Why is it so hard for you to accept that intelligent people can > >disagree with you, and that what's right for you might be bad for > >others? > > Ask the same

Re: Annoying octal notation

2009-08-24 Thread Gabriel Genellina
En Mon, 24 Aug 2009 14:40:24 -0300, Derek Martin escribió: Why is it so hard for you to accept that intelligent people can disagree with you, and that what's right for you might be bad for others? Ask the same question yourself please. -- Gabriel Genellina -- http://mail.python.org/mailma

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Mon, Aug 24, 2009 at 05:03:28PM +, Steven D'Aprano wrote: > On Mon, 24 Aug 2009 11:21:46 -0500, Derek Martin wrote: > > since the old syntax is prevalent both within and without the > > Python community, making the change is, was, and always will be a > > bad idea. > > Octal syntax isn't pre

Re: Annoying octal notation

2009-08-24 Thread Harald Luessen
On Mon, 24 Aug 2009 Derek Martin wrote: >Those participating in this thread have pretty much all seem to agree >that the only places where decimal numbers with leading zeros really >are common are either in rather specialized applications, such as >computer-oriented data or serial numbers (which ty

Re: Annoying octal notation

2009-08-24 Thread Steven D'Aprano
On Mon, 24 Aug 2009 11:21:46 -0500, Derek Martin wrote: > since the old > syntax is prevalent both within and without the Python community, making > the change is, was, and always will be a bad idea. Octal syntax isn't prevalent *at all*, except in a small number of niche areas. You've said tha

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Mon, Aug 24, 2009 at 04:47:43PM +, Steven D'Aprano wrote: > Except of course to anyone familiar with mathematics in the last, oh, > five hundred years or so. Mathematics has used a positional system for > numbers for centuries now: leading zeroes have been insignificant, just > like trail

Re: Annoying octal notation

2009-08-24 Thread Steven D'Aprano
On Mon, 24 Aug 2009 09:14:25 -0500, Derek Martin wrote: > Assuming I'm right about that, then the use of a leading 0 to represent > octal actually predates the prevalence of using 0 in dates by almost two > decades. And while using leading zeros in other contexts is "familiar" > to me, I would ce

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Mon, Aug 24, 2009 at 08:31:13AM -0700, Carl Banks wrote: > On Aug 24, 6:56 am, Derek Martin wrote: > > I think hard-coding dates is more uncommon than using octal. ;-) > > [It unquestionably is, for me personally.] > > You just don't get it, do you? I think I get it just fine, thanks. > Do

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread Scott David Daniels
Piet van Oostrum wrote: Scott David Daniels (SDD) wrote: SDD> James Harris wrote:... Another option: 0.(2:1011), 0.(8:7621), 0.(16:c26b) where the three characters "0.(" begin the sequence. Comments? Improvements? SDD> I did a little interpreter where non-base 10 numbers SDD> (up to ba

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Mon, Aug 24, 2009 at 05:22:39PM +0200, Hendrik van Rooyen wrote: > > Assuming I'm right about that, then the use of a leading 0 to > > represent octal actually predates the prevalence of using 0 in dates > > by almost two decades. > > Not quite - at the time I started, punch cards and data ent

Re: Literal concatenation, strings vs. numbers (was: Numeric literals in other than base 10 - was Annoying octal notation)

2009-08-24 Thread Steven D'Aprano
On Mon, 24 Aug 2009 12:45:25 +1000, Ben Finney wrote: > greg writes: > >> J. Cliff Dyer wrote: >> >> > What happens if you use a literal like 0x10f 304? >> >> To me the obvious thing to do is concatenate them textually and then >> treat the whole thing as a single numeric literal. Anything else

Re: Annoying octal notation

2009-08-24 Thread Carl Banks
On Aug 24, 6:56 am, Derek Martin wrote: > I think > hard-coding dates is more uncommon than using octal. ;-)  [It > unquestionably is, for me personally.] You just don't get it, do you? Do you really think this is a contest over what's more common and the winner gets to choose the syntax? You r

Re: Numeric literals in other than base 10 - was Annoying octal?notation

2009-08-24 Thread garabik-news-2005-05
J. Cliff Dyer wrote: > I had an objection to using spaces in numeric literals last time around > and it still stands, and it still stands in the new one. > Or, we can use U+00A0 NO-BREAK SPACE, once we already have unicode variable names :-) (probably some people would find it difficult to type,

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Mon, Aug 24, 2009 at 08:56:48AM -0500, Derek Martin wrote: > On Sun, Aug 23, 2009 at 01:13:32PM +, Matthew Woodcraft wrote: > > A more common case is dates. > > I suppose this is true, but [...] > I tend to also discount this example, because when we write dates > with leading zeros, usuall

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Sun, Aug 23, 2009 at 01:13:32PM +, Matthew Woodcraft wrote: > Dennis Lee Bieber writes: > > About the only place one commonly sees leading zeros on decimal > > numbers, in my experience, is zero-filled COBOL data decks (and since > > classic COBOL stores in BCD anyway... binary (usage i

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Sun, Aug 23, 2009 at 06:13:31AM +, Steven D'Aprano wrote: > On Sat, 22 Aug 2009 22:19:01 -0500, Derek Martin wrote: > > On Sat, Aug 22, 2009 at 02:55:51AM +, Steven D'Aprano wrote: > >> And the great thing is that now you get to teach yourself to stop > >> writing octal numbers implicitl

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread Mel
James Harris wrote: > On 24 Aug, 02:19, Max Erickson wrote: [ ... ] >> >>> int('100', 3) >> 9 >> >>> int('100', 36) >> 1296 > > This is fine typed into the language directly but couldn't be entered > by the user or read-in from or written to a file. That's rather beside the point. Literals don

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread NevilleDNZ
On Aug 23, 9:42 pm, James Harris wrote: > The numbers above would be > > 0b1011, 0t7621, 0xc26b Algol68 has the type BITS, that is converted to INT with the ABS operator. The numbers above would be: > 2r1011, 8r7621, 16rc26b "r" is for radix: http://en.wikipedia.org/wiki/Radix The standard

Re: Literal concatenation, strings vs. numbers (was: Numeric literals in other than base 10 - was Annoying octal notation)

2009-08-24 Thread Carl Banks
On Aug 23, 7:45 pm, Ben Finney wrote: > greg writes: > > J. Cliff Dyer wrote: > > > > What happens if you use a literal like 0x10f 304? > > > To me the obvious thing to do is concatenate them textually and then > > treat the whole thing as a single numeric literal. Anything else > > wouldn't be s

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread James Harris
On 24 Aug, 09:30, Erik Max Francis wrote: > James Harris wrote: > > On 24 Aug, 09:05, Erik Max Francis wrote: > Here's another suggested number literal format. First, keep the > familar 0x and 0b of C and others and to add 0t for octal. (T is the > third letter of octal as X is the

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread Erik Max Francis
Hendrik van Rooyen wrote: I also tried to include an example of a literal with a base of a Googol but I ran out of both ink and symbols. :-) ... or particles in the observable Universe, for that matter. -- Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/ San Jose, CA, USA

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread Erik Max Francis
James Harris wrote: On 24 Aug, 02:19, Max Erickson wrote: It can be assumed however that .9. isn't in binary? That's a neat idea. But an even simpler scheme might be: .octal.100 .decimal.100 .hex.100 .binary.100 .trinary.100 until it gets to this anyway: .thiryseximal.100 At some point, abando

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread Erik Max Francis
James Harris wrote: On 24 Aug, 09:05, Erik Max Francis wrote: Here's another suggested number literal format. First, keep the familar 0x and 0b of C and others and to add 0t for octal. (T is the third letter of octal as X is the third letter of hex.) The numbers above would be 0b1011, 0t7621,

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread James Harris
On 24 Aug, 09:05, Erik Max Francis wrote: ... > >> Here's another suggested number literal format. First, keep the > >> familar 0x and 0b of C and others and to add 0t for octal. (T is the > >> third letter of octal as X is the third letter of hex.) The numbers > >> above would be > > >>   0b101

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread Hendrik van Rooyen
On Monday 24 August 2009 01:04:37 bartc wrote: > That's a neat idea. But an even simpler scheme might be: > > .octal.100 > .decimal.100 > .hex.100 > .binary.100 > .trinary.100 > > until it gets to this anyway: > > .thiryseximal.100 Yeah right. So now I first have to type a string, which probably

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread James Harris
On 24 Aug, 02:19, Max Erickson wrote: ... > > It can be assumed however that .9. isn't in binary? > > > That's a neat idea. But an even simpler scheme might be: > > > .octal.100 > > .decimal.100 > > .hex.100 > > .binary.100 > > .trinary.100 > > > until it gets to this anyway: > > > .thiryseximal

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread Erik Max Francis
J. Cliff Dyer wrote: I had an objection to using spaces in numeric literals last time around and it still stands, and it still stands in the new one. What happens if you use a literal like 0x10f 304? Is 304 treated as decimal or hexadecimal? It's not clear how you would begin to combine it.

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread Erik Max Francis
MRAB wrote: James Harris wrote: On 23 Aug, 00:16, Mel wrote: James Harris wrote: I have no idea why Ada which uses the # also apparently uses it to end a number 2#1011#, 8#7621#, 16#c26b# Interesting. They do it because of this example from

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread Piet van Oostrum
> Scott David Daniels (SDD) wrote: >SDD> James Harris wrote:... >>> Another option: >>> >>> 0.(2:1011), 0.(8:7621), 0.(16:c26b) >>> >>> where the three characters "0.(" begin the sequence. >>> >>> Comments? Improvements? >SDD> I did a little interpreter where non-base 10 numbers >SDD> (up

Literal concatenation, strings vs. numbers (was: Numeric literals in other than base 10 - was Annoying octal notation)

2009-08-23 Thread Ben Finney
greg writes: > J. Cliff Dyer wrote: > > > What happens if you use a literal like 0x10f 304? > > To me the obvious thing to do is concatenate them textually and then > treat the whole thing as a single numeric literal. Anything else > wouldn't be sane, IMO. Yet, as was pointed out, that behaviour

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread Ben Finney
Max Erickson writes: > At some point, abandoning direct support for literals and just > having a function that can handle different bases starts to make a > lot of sense to me: > > >>> int('100', 8) > 64 > >>> int('100', 10) > 100 > >>> int('100', 16) > 256 > >>> int('100', 2) > 4 > >>> int('10

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread greg
J. Cliff Dyer wrote: What happens if you use a literal like 0x10f 304? To me the obvious thing to do is concatenate them textually and then treat the whole thing as a single numeric literal. Anything else wouldn't be sane, IMO. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread Max Erickson
"bartc" wrote: > > "Scott David Daniels" wrote in message > news:kn2dnszr5b0bwazxnz2dnuvz_s-dn...@pdx.net... >> James Harris wrote:... >>> Another option: > > It can be assumed however that .9. isn't in binary? > > That's a neat idea. But an even simpler scheme might be: > > .octal.100 > .d

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread bartc
"Scott David Daniels" wrote in message news:kn2dnszr5b0bwazxnz2dnuvz_s-dn...@pdx.net... James Harris wrote:... Another option: 0.(2:1011), 0.(8:7621), 0.(16:c26b) where the three characters "0.(" begin the sequence. Comments? Improvements? I did a little interpreter where non-base 10 n

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread Scott David Daniels
James Harris wrote:... Another option: 0.(2:1011), 0.(8:7621), 0.(16:c26b) where the three characters "0.(" begin the sequence. Comments? Improvements? I did a little interpreter where non-base 10 numbers (up to base 36) were: .7.100 == 64 (octal) .9.100 == 100 (decimal)

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread MRAB
James Harris wrote: On 23 Aug, 00:16, Mel wrote: James Harris wrote: I have no idea why Ada which uses the # also apparently uses it to end a number 2#1011#, 8#7621#, 16#c26b# Interesting. They do it because of this example from

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread James Harris
On 23 Aug, 21:55, James Harris wrote: ... > >  However for floating point you > > need at least three letters because a floating point number has > > three parts: the fixed point point, the exponent base, and the > > exponent.  Now we can represent the radices of the individual > > parts with th

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread James Harris
On 23 Aug, 00:16, Mel wrote: > James Harris wrote: > > I have no idea why Ada which uses the # also apparently uses it to end > > a number > > >   2#1011#, 8#7621#, 16#c26b# > > Interesting.  They do it because of this example from >

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread James Harris
On 23 Aug, 04:38, c...@tiac.net (Richard Harter) wrote: > On Sat, 22 Aug 2009 14:54:41 -0700 (PDT), James Harris > > > > > > wrote: > >On 22 Aug, 10:27, David <71da...@libero.it> wrote: > > >... (snipped a discussion on languages and other systems interpreting > >numbers with a leading zero as oct

Re: Annoying octal notation

2009-08-23 Thread James Harris
On 21 Aug, 00:59, James Harris wrote: ... > > Is there some magic to make the 2.x CPython interpreter to ignore the > > annoying octal notation? > > I'd really like 012 to be "12" and not "10". > > This is (IMHO) a sad hangover from C (which to

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread bartc
wrote in message news:h6r4fb$18...@aioe.org... In comp.lang.python James Harris wrote: On 22 Aug, 10:27, David <71da...@libero.it> wrote: ... What about 2_1011, 8_7621, 16_c26h or 2;1011, 8;7621, 16;c26h ? They look good - which is important. The trouble (for me) is that I want the not

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread J. Cliff Dyer
I had an objection to using spaces in numeric literals last time around and it still stands, and it still stands in the new one. What happens if you use a literal like 0x10f 304? Is 304 treated as decimal or hexadecimal? It's not clear how you would begin to combine it The way string concatena

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread Ben Finney
garabik-news-2005...@kassiopeia.juls.savba.sk writes: > Why not just use the space? 123 000 looks better than 123_000, and is > not syntactically ambiguous (at least in python). And as it already > works for string literals, it could be applied to numbers, too… +1 to all this. I think this discus

Re: Annoying octal notation

2009-08-23 Thread Matthew Woodcraft
Dennis Lee Bieber writes: > About the only place one commonly sees leading zeros on decimal > numbers, in my experience, is zero-filled COBOL data decks (and since > classic COBOL stores in BCD anyway... binary (usage is > computational/comp-1) was a later add-on to the data specification mo

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread garabik-news-2005-05
In comp.lang.python James Harris wrote: > On 22 Aug, 10:27, David <71da...@libero.it> wrote: ... >> >> What about 2_1011, 8_7621, 16_c26h or 2;1011, 8;7621, 16;c26h ? > > They look good - which is important. The trouble (for me) is that I > want the notation for a new programming language and a

Re: Annoying octal notation

2009-08-23 Thread Bearophile
MRAB: >'_': what if in the future we want to allow them in numbers for clarity? Hettinger says it's hard (= requires too many changes) to do that and Python programs don't have big integer constants often enough, so probably that improvement will not see the light. In the meantime in a Python pr

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-23 Thread Dmitry A. Kazakov
On Sat, 22 Aug 2009 14:54:41 -0700 (PDT), James Harris wrote: > They look good - which is important. The trouble (for me) is that I > want the notation for a new programming language and already use these > characters. I have underscore as an optional separator for groups of > digits - 123000 and

Re: Annoying octal notation

2009-08-22 Thread Steven D'Aprano
On Sat, 22 Aug 2009 22:19:01 -0500, Derek Martin wrote: > On Sat, Aug 22, 2009 at 02:55:51AM +, Steven D'Aprano wrote: >> > I can see how 012 can >> > be confusing to new programmers, but at least it's legible, and the >> > great thing about humans is that they can be taught (usually). >> >>

Re: Annoying octal notation

2009-08-22 Thread Steven D'Aprano
On Sat, 22 Aug 2009 14:04:17 -0500, Derek Martin wrote: >> These human programmers, whether newbies or long-experienced, also deal >> with decimal numbers every day, many of which are presented as a >> sequence of digits with leading zeros — and we continue to think of >> them as decimal numbers r

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-22 Thread Richard Harter
On Sat, 22 Aug 2009 14:54:41 -0700 (PDT), James Harris wrote: >On 22 Aug, 10:27, David <71da...@libero.it> wrote: > >... (snipped a discussion on languages and other systems interpreting >numbers with a leading zero as octal) > >> > Either hexadecimal should have been 0h or octal should >> > have

Re: Annoying octal notation

2009-08-22 Thread Derek Martin
On Fri, Aug 21, 2009 at 04:23:57PM -0700, James Harris wrote: > You misunderstand. I was saying that taking a leading zero as > indicating octal is archaic. Octal itself is fine where appropriate. I don't see that the leading zero is any more archaic than the use of octal itself... Both originate

Re: Annoying octal notation

2009-08-22 Thread Derek Martin
On Sat, Aug 22, 2009 at 02:55:51AM +, Steven D'Aprano wrote: > > I can see how 012 can > > be confusing to new programmers, but at least it's legible, and the > > great thing about humans is that they can be taught (usually). > > And the great thing is that now you get to teach yourself to sto

Re: Annoying octal notation

2009-08-22 Thread Carl Banks
On Aug 21, 12:48 pm, Derek Martin wrote: > John Nagle wrote: > > Yes, and making lead zeros an error as suggested in PEP 3127 is a > > good idea.  It will be interesting to see what bugs that flushes > > out. > James Harris wrote: > > It maybe made sense once but this relic of the past should have

Re: Annoying octal notation

2009-08-22 Thread Carl Banks
On Aug 22, 12:04 pm, Derek Martin wrote: > On Sat, Aug 22, 2009 at 10:03:35AM +1000, Ben Finney wrote: > > These human programmers, whether newbies or long-experienced, also deal > > with decimal numbers every day, many of which are presented as a > > sequence of digits with leading zeros — and we

  1   2   >