For American numbers

Pierre Hanser hanser at club-internet.fr
Sun Feb 13 02:05:59 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.
> 
> For the rest of the computer world, unless I've missed
> a changing of the guard or something, "kilo" is 1024
> and "mega" is 1024*1024 and so forth...
> 
> -Peter
even for cpu frequency?



More information about the Python-list mailing list