Guido van Rossum wrote:
> On 8/13/07, Andrew James Wade <[EMAIL PROTECTED]> wrote:
> 
>>On Mon, 13 Aug 2007 20:53:26 -0700
>>"Guido van Rossum" <[EMAIL PROTECTED]> wrote:

>>>I propose that their
>>>__format__ be defined like this:
>>>
>>>  def __format__(self, spec):
>>>      return self.strftime(spec)
>>
>>You loose the ability to align the field then.

This might be a use case for the chaining of format specs
that Ron mentioned. Suppose you could do

   "{{1:spec1}:spec2}".format(x)

which would be equivalent to

   format(format(x, "spec1"), "spec2")

then you could do

   "{{1:%Y-%m-%d %H:%M:%S}:<20}".format(my_date)

and get your date left-aligned in a 20-wide field.

(BTW, I'm not sure about using strftime-style formats
as-is, since the % chars look out of place in our new
format syntax.)

--
Greg
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to