Re: [Python-Dev] PEP 3101 Update

2006-05-19 Thread Guido van Rossum
On 5/6/06, Talin [EMAIL PROTECTED] wrote: I've updated PEP 3101 based on the feedback collected so far. [http://www.python.org/dev/peps/pep-3101/] I think this is a step in the right direction. I wonder if we shouldn't borrow more from .NET. I read this URL that you referenced:

Re: [Python-Dev] PEP 3101 Update

2006-05-19 Thread Talin
Guido van Rossum wrote: On 5/6/06, Talin [EMAIL PROTECTED] wrote: I've updated PEP 3101 based on the feedback collected so far. [http://www.python.org/dev/peps/pep-3101/] I think this is a step in the right direction. Cool, and thanks for the very detailed feedback. I wonder if we

Re: [Python-Dev] PEP 3101 Update

2006-05-19 Thread Guido van Rossum
On 5/19/06, Talin [EMAIL PROTECTED] wrote: Guido van Rossum wrote: [http://www.python.org/dev/peps/pep-3101/] http://msdn.microsoft.com/library/en-us/cpguide/html/cpconcompositeformatting.asp [on width spec a la .NET] We already have that now, don't we? If you look at the docs for String

Re: [Python-Dev] PEP 3101 Update

2006-05-19 Thread Talin
Guido van Rossum wrote: [on escaping] There is another solution to this which is equally subtle, although fairly straightforward to parse. It involves defining the rules for escapes as follows: '{{' is an escaped '{' '}}' is an escaped '}', unless we are within a field. So you

Re: [Python-Dev] PEP 3101 Update

2006-05-19 Thread Guido van Rossum
On 5/19/06, Talin [EMAIL PROTECTED] wrote: Since you seem to be in a PEP-review mode, could you have a look at 3102? In particular, it seems that all of the controversies on that one have quieted down; Virtually everyone seems in favor of the first part, and you have already ruled in favor of

Re: [Python-Dev] PEP 3101 Update

2006-05-08 Thread Talin
Steven Bethard steven.bethard at gmail.com writes: I'm still not a big fan of mixing together getitem-style access and getattribute-style access. That makes classes that support both ambiguous in this context. You either need to specify the order in which these are checked (e.g. attribute

Re: [Python-Dev] PEP 3101 Update

2006-05-08 Thread Talin
Steven Bethard steven.bethard at gmail.com writes: I believe the proposal is taking advantage of the fact that '\{' is not interpreted as an escape sequence -- it is interpreted as a literal backslash followed by an open brace: This is exactly correct. -- Talin

Re: [Python-Dev] PEP 3101 Update

2006-05-08 Thread Edward Loper
Steven Bethard wrote: On 5/7/06, Edward Loper [EMAIL PROTECTED] wrote: Talin wrote: Braces can be escaped using a backslash: My name is {0} :-\{\}.format('Fred') Which would produce: My name is Fred :-{} Do backslashes also need to be backslashed then? If

Re: [Python-Dev] PEP 3101 Update

2006-05-08 Thread Michael Chermside
One small comment: The conversion specifier consists of a sequence of zero or more characters, each of which can consist of any printable character except for a non-escaped '}'. Escaped? How are they escaped? (with '\'?) If so, how are backslashes escaped (with '\\'?) And does the

Re: [Python-Dev] PEP 3101 Update

2006-05-08 Thread Talin
Michael Chermside mcherm at mcherm.com writes: One small comment: The conversion specifier consists of a sequence of zero or more characters, each of which can consist of any printable character except for a non-escaped '}'. Escaped? How are they escaped? (with '\'?) If

Re: [Python-Dev] PEP 3101 Update

2006-05-08 Thread Michael Chermside
I wrote: - Variable field width specifiers use a nested version of the {} syntax, allowing the width specifier to be either a positional or keyword argument: {0:{1}.{2}d}.format(a, b, c) This violates [the rule that '}' must be escaped] Talin writes: What

Re: [Python-Dev] PEP 3101 Update

2006-05-07 Thread Edward Loper
Talin wrote: Braces can be escaped using a backslash: My name is {0} :-\{\}.format('Fred') Which would produce: My name is Fred :-{} Do backslashes also need to be backslashed then? If not, then what is the translation of this:? r'abc\{%s\}' % 'x' I

Re: [Python-Dev] PEP 3101 Update

2006-05-07 Thread Joe Smith
Edward Loper [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Talin wrote: Braces can be escaped using a backslash: My name is {0} :-\{\}.format('Fred') Which would produce: My name is Fred :-{} Do backslashes also need to be backslashed then? If

Re: [Python-Dev] PEP 3101 Update

2006-05-07 Thread Greg Ewing
Joe Smith wrote: AFAICT there would be no way to use raw strings with that method. ... Additional backslashes are added to raw strings to remove anything that resembles an escape sequence. You seem to be very confused about the way strings work. If you look at the repr() of a string

Re: [Python-Dev] PEP 3101 Update

2006-05-07 Thread Steven Bethard
On 5/7/06, Edward Loper [EMAIL PROTECTED] wrote: Talin wrote: Braces can be escaped using a backslash: My name is {0} :-\{\}.format('Fred') Which would produce: My name is Fred :-{} Do backslashes also need to be backslashed then? If not, then what is

Re: [Python-Dev] PEP 3101 Update

2006-05-07 Thread Steven Bethard
On 5/6/06, Talin [EMAIL PROTECTED] wrote: I've updated PEP 3101 based on the feedback collected so far. [snip] Compound names are a sequence of simple names seperated by periods: My name is {0.name} :-\{\}.format(dict(name='Fred')) Compound names can be used to

[Python-Dev] PEP 3101 Update

2006-05-06 Thread Talin
I've updated PEP 3101 based on the feedback collected so far. - PEP: 3101 Title: Advanced String Formatting Version: $Revision: 45928 $ Last-Modified: $Date: 2006-05-06 18:49:43 -0700 (Sat, 06 May 2006) $ Author: Talin talin at acm.org Status: Draft Type: Standards