For American numbers
Alan Kennedy
alanmk at hotmail.com
Sun Feb 13 09:38:32 EST 2005
[Scott David Daniels]
>> 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
>
>
[Peter Hansen]
> 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...
Maybe you missed these?
http://en.wikipedia.org/wiki/Kibibyte
http://en.wikipedia.org/wiki/Mebibyte
http://en.wikipedia.org/wiki/Gibibyte
kilo-mega-giga-etc-should-be-powers-of-10-ly y'rs,
--
alan kennedy
------------------------------------------------------
email alan: http://xhaus.com/contact/alan
More information about the Python-list
mailing list