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: 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: 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: 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: Numeric literals in other than base 10

2009-08-27 Thread robin
"James Harris" wrote in message news:bc3607b3-7fdd-43fd-8ede-66ac3f597...@32g2000yqj.googlegroups.com... On 22 Aug, 10:27, David <71da...@libero.it> 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

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: 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: 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: 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: 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: 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: 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: 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

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: 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: 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: 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: 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: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-22 Thread Mel
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 : 2#1#E8-- an in