Underscores in Python numbers

Bengt Richter bokr at oz.net
Sun Nov 20 22:00:35 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...). 
>
>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
Um, about your sig ... ;-)

Regards,
Bengt Richter



More information about the Python-list mailing list