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
--
http://mail.python.org/mailman/listinfo/python-list
  • Re... Peter Hansen
    • ... Nick Coghlan
    • ... Roel Schroeven
      • ... Peter Hansen
    • ... Pierre Hanser
      • ... Peter Hansen
    • ... Nick Craig-Wood
      • ... Dan Bishop
        • ... Jong <ruud<dot>de<dot>jong<at>consunet <dot>

Reply via email to