Terry Reedy wrote:
> A nice demonstration of what an excellent piece of work the new .format
> is or is becoming. I would still like it to be a goal for 3.2 that all
> stdlib modules that work with formats accept the new formats and not
> just % formats.
>
> Mark Summerfield only covered .format i
Nick Coghlan wrote:
s...@pobox.com wrote:
My
apologies if I don't understand some amazing generality about format()
format("Header", '=^20s')
'===Header==='
"Format a single object {0!r}, multiple times in a single string.
Year: {0.year}; Month: {0.month}; Day: {0.day}; Formatte
s...@pobox.com wrote:
> My
> apologies if I don't understand some amazing generality about format()
>>> format("Header", '=^20s')
'===Header==='
>>> "Format a single object {0!r}, multiple times in a single string.
Year: {0.year}; Month: {0.month}; Day: {0.day}; Formatted:
{0:%Y-%M-%d}"
Mark> So should commas be inserted for any fill character at all?
While I'm at it, it makes no sense to me to pad numbers with anything other
than whitespace or zero. (BTW: I have never liked the new format() stuff,
so I will be sticking with %-formatting as long as it exists in Python. My
Mark Dickinson wrote:
I find it odd that, for float formatting, the choice of fill character
affects whether commas are inserted:
Python 3.2a0 (py3k:76671, Dec 4 2009, 18:55:54)
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more infor
On Sat, Dec 5, 2009 at 1:18 PM, wrote:
>
> >>> format(Decimal(1234), '020,g')
> '0,000,000,000,001,234'
> >>> format(Decimal(1234), '0=20,g')
> '0001,234'
>
> Why in the world would you ever want to insert commas as separators and not
> use them consistently?
So should co
> Sorry for being a curmudgeon, however...
>
> >>> format(Decimal(1234), '020,g')
> '0,000,000,000,001,234'
> >>> format(Decimal(1234), '0=20,g')
> '0001,234'
>
> Why in the world would you ever want to insert commas as separators and not
> use them consistently?
>
>
Sorry for being a curmudgeon, however...
>>> format(Decimal(1234), '020,g')
'0,000,000,000,001,234'
>>> format(Decimal(1234), '0=20,g')
'0001,234'
Why in the world would you ever want to insert commas as separators and not
use them consistently?
>>> format(Decima
On Sat, Dec 5, 2009 at 11:18 AM, Stefan Krah wrote:
> Hi,
>
> I'm in the process of implementing formatting in my C-decimal module.
> Since testing is quite time consuming, I would appreciate a binding
> decision on how the following should be formatted:
>
from decimal import *
format(fl
Hi,
I'm in the process of implementing formatting in my C-decimal module.
Since testing is quite time consuming, I would appreciate a binding
decision on how the following should be formatted:
>>> from decimal import *
>>> format(float(1234), '020,g')
'0,000,000,000,001,234'
>>> format(float(1234
10 matches
Mail list logo