What purpose does the underscore play? I see that it is
accepted, I just
can't figure out why. I have never seen it as part of proper numeric
syntax, anywhere, in three decades in this business.
a = 1_2_3_4_5_6_7 # => 1234567
big = 10000000
Quick, is that 1e6 or 1e7 or 1e8?
vs.
big = 10_000_000
···
From: Paul Lutus [mailto:nospam@nosite.zzz]
Gavin Kistner wrote:
From: Paul Lutus [mailto:nospam@nosite.zzz]
What purpose does the underscore play? I see that it is
accepted, I just
can't figure out why. I have never seen it as part of proper numeric
syntax, anywhere, in three decades in this business.
a = 1_2_3_4_5_6_7 # => 1234567
big = 10000000
Quick, is that 1e6 or 1e7 or 1e8?
vs.
big = 10_000_000
You mean, avoid ambiguous locale-specific group separators ",|.", yes?
Interesting. Never saw that before. Plenty of underscores, none of them in
numbers.
···
--
Paul Lutus
http://www.arachnoid.com
Gavin Kistner wrote:
From: Paul Lutus [mailto:nospam@nosite.zzz]
What purpose does the underscore play? I see that it is
accepted, I just
can't figure out why. I have never seen it as part of proper numeric
syntax, anywhere, in three decades in this business.
a = 1_2_3_4_5_6_7 # => 1234567
big = 10000000
Quick, is that 1e6 or 1e7 or 1e8?
vs.
big = 10_000_000
You mean, avoid ambiguous locale-specific group separators ",|.", yes?
Interesting. Never saw that before. Plenty of underscores, none of them in
numbers.
--
I think more for input convenience
x = 10000000 => 10000000
y = 10_000_000 => 10000000
z = 10,000,000 => [10, 0, 0]
···
----- Original Message ----- From: "Paul Lutus" <nospam@nosite.zzz>
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Friday, November 17, 2006 5:05 PM
Subject: Re: ruby equivalent PHP function is_numeric?