Underscores in Python numbers

Bengt Richter bokr at oz.net
Sun Nov 20 22:06:18 EST 2005


On Sun, 20 Nov 2005 15:50:10 +0100, Eric Jacoboni <jaco at neottia.net> wrote:

>Mike Meyer <mwm at mired.org> writes:
>
>> I've seen at least one language (forget which one) that allowed such
>> separators, but only for groups of three. So 123_456 would be valid,
>> but 9_1 would be a syntax error. 
>
>Ada allows underscores in numeric literals since 1983, without
>enforcing any grouping. The Ruby language allows also this
>notation. You may write 1_000_001 or 1000_001 or 10_00_001, etc. (the
>same for real numbers...). 
>
Actually, I guess I could be convinced, even though I posted a
you-can-do-this-now decorator to bracket the op's desired function defs.

>When you have the habit to represent literals like that, all other
>big numeric literals or workarounds to create grouping seem cryptic. 
>
>-- 
>Eric Jacoboni, ne il y a 1435938104 secondes
My previous smiley re your sig in this thread context still applies ;-)

Regards,
Bengt Richter



More information about the Python-list mailing list