On 02/22/2011 07:32 PM, Eric Smith wrote:
On 2/22/2011 6:28 PM, Steve Holden wrote:
On Feb 22, 2011, at 3:08 PM, Eric Smith wrote:
Quoting PEP 3101:
An example of the 'getitem' syntax:
My name is {0[name]}.format(dict(name='Fred'))
It should be noted that the use of 'getitem' within a
On Wed, Feb 23, 2011 at 9:32 AM, Senthil Kumaran orsent...@gmail.com wrote:
Because keys are not quote-delimited, it is not possible to
specify arbitrary dictionary keys (e.g., the strings 10 or
:-]) from within a format string.
I was curious as to whether or not nested substitution
On Tue, 22 Feb 2011 19:32:56 -0500, Eric Smith e...@trueblade.com wrote:
You are correct, I didn't exactly implement the PEP on this point,
probably as a shortcut. I think there's an issue somewhere that
discusses this, but I can't find it. The CPython implementation is
really using If
On 02/23/2011 09:42 AM, R. David Murray wrote:
On Tue, 22 Feb 2011 19:32:56 -0500, Eric Smithe...@trueblade.com wrote:
You are correct, I didn't exactly implement the PEP on this point,
probably as a shortcut. I think there's an issue somewhere that
discusses this, but I can't find it. The
On Feb 23, 2011, at 5:42 AM, Nick Coghlan wrote:
Ah, how (much more) confused would we be if we didn't have the PEPs
and mailing list archives to remind ourselves of what we were thinking
years ago...
True. And how much more useful it would be if it were incorporated into the
documentation
Eric Smith wrote:
On 2/22/2011 6:28 PM, Steve Holden wrote:
On Feb 22, 2011, at 3:08 PM, Eric Smith wrote:
Quoting PEP 3101:
An example of the 'getitem' syntax:
My name is {0[name]}.format(dict(name='Fred'))
It should be noted that the use of 'getitem' within a format string
is much
On Feb 23, 2011, at 5:42 AM, Nick Coghlan wrote:
Ah, how (much more) confused would we be if we didn't have the PEPs
and mailing list archives to remind ourselves of what we were thinking
years ago...
True. And how much more useful it would be if it were incorporated into
the documentation
One of the students on an introductory Python 3 class asks a very good question
about string formatting. This could be because the course materials are
misleading, so I would like to understand. It would appear from tests that
{0[X]}.format(...) first tries to convert the string X to in
On Tue, Feb 22, 2011 at 6:01 PM, Steve Holden st...@holdenweb.com wrote:
... It would appear from tests
that {0[X]}.format(...) first tries to convert the string X to in
integer. If it succeeds then __getitem__() is called with the integer as an
argument, otherwise it is called with the string
Quoting PEP 3101:
An example of the 'getitem' syntax:
My name is {0[name]}.format(dict(name='Fred'))
It should be noted that the use of 'getitem' within a format string
is much more limited than its conventional usage. In the above example,
the string 'name' really is the literal
On Feb 22, 2011, at 3:08 PM, Eric Smith wrote:
Quoting PEP 3101:
An example of the 'getitem' syntax:
My name is {0[name]}.format(dict(name='Fred'))
It should be noted that the use of 'getitem' within a format string
is much more limited than its conventional usage. In the
On Tue, Feb 22, 2011 at 6:01 PM, Steve Holden st...@holdenweb.com wrote:
... It would appear from tests
that {0[X]}.format(...) first tries to convert the string X to in
integer. If it succeeds then __getitem__() is called with the integer as an
argument, otherwise it is called with the
On 2/22/2011 6:32 PM, Senthil Kumaran wrote:
On Tue, Feb 22, 2011 at 6:01 PM, Steve Holdenst...@holdenweb.com wrote:
... It would appear from tests
that {0[X]}.format(...) first tries to convert the string X to in
integer. If it succeeds then __getitem__() is called with the integer as an
On 2/22/2011 6:28 PM, Steve Holden wrote:
On Feb 22, 2011, at 3:08 PM, Eric Smith wrote:
Quoting PEP 3101:
An example of the 'getitem' syntax:
My name is {0[name]}.format(dict(name='Fred'))
It should be noted that the use of 'getitem' within a format string
is much more limited
14 matches
Mail list logo