Re: Human readable number formatting

2005-09-28 Thread [EMAIL PROTECTED]
MrJean1 wrote: > No, I didn't. See the references at the bottom. > > /Jean Brouwers So when I say "I'm sorta busy" it means I'm REALLY busy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Human readable number formatting

2005-09-28 Thread MrJean1
No, I didn't. See the references at the bottom. /Jean Brouwers -- http://mail.python.org/mailman/listinfo/python-list

Re: Human readable number formatting

2005-09-28 Thread Robert Kern
Paul Rubin wrote: > "MrJean1" <[EMAIL PROTECTED]> writes: > >>Ocha O + 54 - o otro >>Nena N + 57 -nk nekto >>MInga MI+ 60 -mk mikto >>Luma L + 63 - l lunto > > Please tell me you're making this up. No, but someone els

Re: Human readable number formatting

2005-09-28 Thread Paul Rubin
"MrJean1" <[EMAIL PROTECTED]> writes: > Ocha O + 54 - o otro > Nena N + 57 -nk nekto > MInga MI+ 60 -mk mikto > Luma L + 63 - l lunto Please tell me you're making this up. -- http://mail.python.org/mailman/listinfo/pyt

Re: Human readable number formatting

2005-09-28 Thread MrJean1
Here is another function for human formatting: def sistr(value, prec=None, K=1024.0, k=1000.0, sign='', blank=' '): ''' Convert value to a signed string with an SI prefix. The 'prec' value specifies the number of fractional digits to be included. Use 'prec=0' to omit any fr

Re: Human readable number formatting

2005-09-27 Thread J Correia
"Alex Willmer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > When reporting file sizes to the user, it's nice to print '16.1 MB', > rather than '16123270 B'. This is the behaviour the command 'df -h' > implements. There's no python function that I could find to perform this > format

Re: Human readable number formatting

2005-09-27 Thread Erik Max Francis
Alex Willmer wrote: > When reporting file sizes to the user, it's nice to print '16.1 MB', > rather than '16123270 B'. This is the behaviour the command 'df -h' > implements. There's no python function that I could find to perform this > formatting , so I've taken a stab at it: BOTEC at

Re: Human readable number formatting

2005-09-27 Thread Mike Meyer
Alex Willmer <[EMAIL PROTECTED]> writes: > When reporting file sizes to the user, it's nice to print '16.1 MB', > rather than '16123270 B'. This is the behaviour the command 'df -h' > implements. There's no python function that I could find to perform this > formatting , so I've taken a stab at it

Re: Human readable number formatting

2005-09-27 Thread jepler
Compared to your program, I think the key to mine is to divide by "limit" before taking the log. In this way, things below the "limit" go to the next lower integer. I think that instead of having 'step' and 'base', there should be a single value which would be 1000 or 1024. import math def Mak

Human readable number formatting

2005-09-27 Thread Alex Willmer
When reporting file sizes to the user, it's nice to print '16.1 MB', rather than '16123270 B'. This is the behaviour the command 'df -h' implements. There's no python function that I could find to perform this formatting , so I've taken a stab at it: import math def human_readable(n, suffix='B', p