Re: [Python-3000] string.Formatter class

2007-08-30 Thread Ron Adam
Eric Smith wrote: > Ron Adam wrote: >> >> >> Eric Smith wrote: >>> Ron Adam wrote: > get_field(field_name, args, kwargs, used_args) > Given a field_name as returned by parse, convert it to an object to > be formatted. The default version takes strings of the form > defined in t

Re: [Python-3000] string.Formatter class

2007-08-30 Thread Talin
Eric Smith wrote: > Ron Adam wrote: >> I wonder if this is splitting things up a bit too finely? If the format >> function takes a conversion argument, it makes it possible to do >> everything by overriding format_field. >> >> def format_field(self, value, format_spec, conversion): >>

Re: [Python-3000] string.Formatter class

2007-08-30 Thread Eric Smith
Ron Adam wrote: > > > Eric Smith wrote: >> Ron Adam wrote: get_field(field_name, args, kwargs, used_args) Given a field_name as returned by parse, convert it to an object to be formatted. The default version takes strings of the form defined in the PEP, such as "0[name]" or

Re: [Python-3000] string.Formatter class

2007-08-30 Thread Ron Adam
Eric Smith wrote: > Ron Adam wrote: >>> get_field(field_name, args, kwargs, used_args) >>> Given a field_name as returned by parse, convert it to an object to >>> be formatted. The default version takes strings of the form defined >>> in the PEP, such as "0[name]" or "label.title". It records

Re: [Python-3000] string.Formatter class

2007-08-30 Thread Eric Smith
Ron Adam wrote: >> get_field(field_name, args, kwargs, used_args) >> Given a field_name as returned by parse, convert it to an object to be >> formatted. The default version takes strings of the form defined in >> the PEP, such as "0[name]" or "label.title". It records which args >> have been

Re: [Python-3000] string.Formatter class

2007-08-30 Thread Ron Adam
Eric Smith wrote: > One of the things that PEP 3101 deliberately under specifies is the > Formatter class, leaving decisions up to the implementation. Now that a > working implementation exists, I think it's reasonable to tighten it up. > > I have checked in a Formatter class that specifies t

Re: [Python-3000] string.Formatter class

2007-08-30 Thread Eric Smith
Talin wrote: > Eric Smith wrote: >> Eric Smith wrote: >>> Jim Jewett wrote: >> but you might want to take inspiration from the "tail" of an elementtree node, and return the field with the literal next to it as a single object. (literal_text, field_name, format_spec, con

Re: [Python-3000] string.Formatter class

2007-08-30 Thread Talin
Eric Smith wrote: > Eric Smith wrote: >> Jim Jewett wrote: > >>> but you might want to take inspiration from the "tail" of an >>> elementtree node, and return the field with the literal next to it as >>> a single object. >>> >>> (literal_text, field_name, format_spec, conversion) >> I think I

Re: [Python-3000] string.Formatter class

2007-08-28 Thread Eric Smith
Eric Smith wrote: > Jim Jewett wrote: >> but you might want to take inspiration from the "tail" of an >> elementtree node, and return the field with the literal next to it as >> a single object. >> >> (literal_text, field_name, format_spec, conversion) > > I think I like that best. I impleme

Re: [Python-3000] string.Formatter class

2007-08-28 Thread Eric Smith
Jim Jewett wrote: > On 8/28/07, Eric Smith <[EMAIL PROTECTED]> wrote: >> parse(format_string) > >> ... returns an iterable of tuples >> (literal_text, field_name, format_spec, conversion) > > Which are really either > > (literal_text, None, None, None) > or > (None, field_name, format_sp

Re: [Python-3000] string.Formatter class

2007-08-28 Thread Jim Jewett
On 8/28/07, Eric Smith <[EMAIL PROTECTED]> wrote: > parse(format_string) >... returns an iterable of tuples > (literal_text, field_name, format_spec, conversion) Which are really either (literal_text, None, None, None) or (None, field_name, format_spec, conversion) I can't help thinking

Re: [Python-3000] string.Formatter class

2007-08-28 Thread Eric Smith
Eric Smith wrote: > One of the things that PEP 3101 deliberately under specifies is the > Formatter class, leaving decisions up to the implementation. Now that a > working implementation exists, I think it's reasonable to tighten it up. I should also have included the recipe for the 'smart' f

[Python-3000] string.Formatter class

2007-08-28 Thread Eric Smith
One of the things that PEP 3101 deliberately under specifies is the Formatter class, leaving decisions up to the implementation. Now that a working implementation exists, I think it's reasonable to tighten it up. I have checked in a Formatter class that specifies the following methods (in addi