Re: Pruss Manifesto - Long numbers
From: Mel Wilson (mwilson_at_the-wire.com)
Date: Tue, 11 Nov 2003 09:58:54 -0500
In article <firstname.lastname@example.org>,
email@example.com (Michele Simionato) wrote:
>> Georgy Pruss wrote:
>> 1) Underscores in numbers. It will help to read long numbers.
>> 12 345 678
>> 3.14159 26535 89793 23846
>Typically, long numbers are not in the program code, but in an
>external data file. Then, they can be read as strings and converted
>to numbers with a one-liner:
>>>> def i(x): return int(x.replace(" ",""))
>>>> i("1 234")
>So, this "feature" is not worth the effort, IMHO.
Except in some cryptological code, e.g. DES, Blowfish.
But the 'i' solution works just as well inside a program.
def h (s): return int (s.replace ('_', ''), 16)
def ks0tbl ():
return map (h, (
'd131_0ba6', '98df_b5ac', '2ffd_72db', 'd01a_dfb7',
[page (printed, not screen) of hex constants]
'53b0_2dfd', 'a99f_8fa1', '08ba_4799', '6e85_076a'
ks0 = ks0tbl()