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

Reply via email to