On Tue, Oct 7, 2008 at 7:58 AM, Jorge Vargas <[EMAIL PROTECTED]> wrote:
>
> Is this not implemented or I miss it somewhere? if it isn't
> implemented I think that the rails version is good enough to be ported
> to number.py

It was left out for a few reasons:

- There were multiple slightly different implementations (the other is
in WebHelpers*.egg/unfinished/helpers.py written by James), and I
wasn't sure which API was best.

- I wasn't sure if the function was universal enough and non-trivial
enough to warrant being in WebHelpers.

- "human size" is not an accurate function name.  The terms are
generally applied to computer hardware, and are perceived as precise
scientific terms rather than colloquial (human) terms.

I like how James's helper supports both binary units (base 1024, GiB)
and decimal units (base 1000, GB), but I don't like how you have to
pass a list of units to every call, or how the units can get out of
sync of the 'binary' flag. The rails helper does not support decimal
units at all.

The rails helper has a  ``precision`` argument that's inadequately
documented (what exactly does it do?).  James's helper has a
``digits`` argument, meaning the total number of digits on either side
of the decimal point.  I'm not sure if that's the right approach
either.
Should it be the number of digits after the decimal point?

I would tend to support a function something like this:

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.

So what do y'all suggest?

-- 
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