Ron Adam wrote:
>
> Greg Ewing wrote:
>> Ron Adam wrote:
>>
>>> The digits value are number of digits before the decimal. This doesn't
>>> include the other symbols used in the field so it isn't the same as a field
>>> width.
>> How does this work with formats where the number of
>> digits before the decimal can vary, but before+after
>> is constant?
>
> I think this is what you're looking for.
>
> f>15,.3 #15 field width, 3 decimal places, right aligned.
>
> In this case the sign will be right before the most significant digit.
>
> Or you could use...
>
> f 10.3 # total width = 15
>
> In this one, the sign would be to the far left of the field. So they are
> not the same thing. The space is used here to make positives numbers the
> same width as negatives values.
>
>
>> Also, my feeling about the whole of this is that
>> it's too complicated. It seems like you can have
>> at least three numbers in a format, and at first
>> glance it's quite confusing as to what they all
>> mean.
>
> Well, at first glance so is everything else that's been suggested, it's
> because we are doing a lot in a very little space. In this case we are
> adding just a touch of complexity to the syntax in order to use grouping to
> remove complexity in understanding the expression.
>
> These are all field width terms:
>
> >10 right align in field 10
> ^15/_ center in field 15, pad with underscores
> 20/* left align in field 20, pad with *
>
> They are easy to identify because other terms do not contain '<^>/'. And
> sense they are separate from other format terms, once you get it, you've
> got it. Nothing more to remember here.
>
> It doesn't make sense to put signs in front of field widths because the
> signs have no relation to the field width at all.
>
>
> These are all number formats:
>
> +10.4
> (10.4)
> .6
> ' 9.3' Quoted so you can see the space.
> 10.
>
> Here, we don't use alignment symbols. Alignments have no meaning in the
> context of number of digits. So these taken as a smaller chunk of the
> whole will also be easier to remember. There are no complex interactions
> between field alignment terms, and number terms this way. That makes
> simpler to understand and learn.
>
>
> Lets take apart the alternative syntax.
>
> f<+15.2
>
> f fixed point # of decimals is specified
>
> < align left (field attribute)
>
> + sign (number attribute)
>
> 15 width (field attribute)
>
> .2 decimals (number attribute)
Then why not have something more readable like
al;s+;w15;d2
This is longer that <+15.2, but IMHO much more readable, because it's
clear where each specifier ends and begins.
Servus,
Walter
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com