On Tue, Oct 7, 2008 at 3:26 PM, Mike Orr <[EMAIL PROTECTED]> wrote:
> def format_size(n, binary, precision?)
>    ``n`` -- the number
>    ``binary`` -- true to use base 1024 and the "Gi" series.
>    ``precision`` -- not sure about this
>
> But then there's the question of bits (b) vs bytes (B), and people
> wanting the whole word spelled out, etc.

Perhaps this:

def format_size(n, binary, suffix="B", fullname=False, precision?):

>>> format_size(5000, False)
5 MB
>>> format_size(5120, True, "bytes")
5 Mibytes
>>> format_size(5000, False, "bytes", True)
5 megabytes

What should ``binary`` default to, or should it have a default?

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to