For American numbers

Roel Schroeven rschroev_nospam_ml at fastmail.fm
Sun Feb 13 00:32:43 EST 2005


Peter Hansen wrote:
> Scott David Daniels wrote:
> 
>> Kind of fun exercise (no good for British English).
>>
>>     def units(value, units='bytes'):
>>         magnitude = abs(value)
>>         if magnitude >= 1000:
>>             for prefix in ['kilo mega giga tera peta '
>>                            'exa zetta yotta').split():
>>                 magnitude /= 1000.
>>                 if magnitude < 1000.:
>>                     break
> 
> 
> Only for hard drive manufacturers, perhaps.

And physicists and chemists and engineers and all other kinds of 
scientists all over the world. Plus those of us in the computer world 
who agree that 'kilo == 1024' is an abomination that should never have 
existed and which we should get rid of as fast as possible.

As fast as possible is not very fast, unfortunately.

-- 
"Codito ergo sum"
Roel Schroeven



More information about the Python-list mailing list