Splitting numeric litterals

Robert Kern robert.kern at gmail.com
Fri Jul 16 14:28:49 EDT 2010


On 7/16/10 12:30 PM, bart.c wrote:
>
> "Steven D'Aprano" <steve at REMOVE-THIS-cybersource.com.au> wrote in message
> news:4c4069de$0$11101$c3e8da3 at news.astraweb.com...
>> On Fri, 16 Jul 2010 14:49:21 +0100, MRAB wrote:
>
>> Not only that, but it only takes 73 digits to write out the total number
>> of particles in the entire universe:
>>
>> 1000000000000000000000000000000000000000000000000000000000000000000000000
>>
>> or 1e72. (Of course that's the lower-bound, estimates range from 1e72 all
>> the way up to 1e87.)
>> So for anything related to counting or labelling
>> actual, physical objects, you will be dealing with smaller numbers than
>> that. E.g. the number of grains of sand on the earth has been estimated
>> (very roughly) as a mere 1000000000000000000000000, or 25 digits.
>
> Big integers tend to be used for playing around with mathematical ideas, and
> they have to be exact. So if you wanted to hardcode 1000! for some reason, you'd
> need some 2568 digits which is a little awkward on one line.

This happens too rarely to justify adding line-spanning integer literals to the 
language's syntax.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list