On Tue, Oct 7, 2008 at 4:26 PM, Mike Orr <[EMAIL PROTECTED]> wrote: > > 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. > oh my grep didn't catch that one as I have a released webhelpers in this project.
> - I wasn't sure if the function was universal enough and non-trivial > enough to warrant being in WebHelpers. > true, but the same could be said of the other number_to_* functions, for example number_to_phone is useless in my country but that doesn't means it is useless everywhere. > - "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. > correct. > 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? > yea I didn't understood that. although I just need a simple representation so the "default" was ok > 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 -~----------~----~----~----~------~----~------~--~---
